Class: Haml::Parser::Line

### Home Classes Methods

### In Files

- lib/haml/parser.rb

### Parent

Struct.new(:text, :unstripped, :full, :index, :compiler, :eod)

### Methods

- #tabs

### Class/Module Index

Quicksearch

- Haml
- Haml::Buffer
- Haml::Compiler
- Haml::Engine
- Haml::Error
- Haml::ErubisTemplateHandler
- Haml::Exec
- Haml::Exec::Generic
- Haml::Exec::Haml
- Haml::Filters
- Haml::Filters::Base
- Haml::Filters::Cdata
- Haml::Filters::Css
- Haml::Filters::Erb
- Haml::Filters::Escaped
- Haml::Filters::Javascript
- Haml::Filters::Plain
- Haml::Filters::PrecompiledTiltFilter
- Haml::Filters::Preserve
- Haml::Filters::Ruby
- Haml::Filters::SassRailsTemplate
- Haml::Filters::ScssRailsTemplate
- Haml::Filters::TiltFilter
- Haml::Helpers
- Haml::Helpers::ActionViewExtensions
- Haml::Helpers::ErrorReturn
- Haml::Helpers::XssMods
- Haml::Options
- Haml::Parser
- Haml::Parser::Line
- Haml::Parser::ParseNode
- Haml::Plugin
- Haml::Railtie
- Haml::SafeErubisTemplate
- Haml::SyntaxError
- Haml::Template
- Haml::Util
- Haml::Util::StaticConditionalContext
- ActionView
- ActionView::Base
- ActionView::Helpers
- ActionView::Helpers::CaptureHelper
- ActionView::Helpers::FormHelper
- ActionView::Helpers::FormTagHelper
- ActionView::Helpers::HamlSupport
- ActionView::Helpers::InstanceTag
- ActionView::Helpers::TagHelper
- ActionView::Helpers::Tags
- ActionView::Helpers::Tags::TextArea
- ActionView::Helpers::TextHelper
- Object

No matching classes.

# Haml::Parser::Line

@private

### Public Instance Methods

tabs() click to toggle source

@private

    # File lib/haml/parser.rb, line 150
    def tabs
      line = self
      @tabs ||= compiler.instance_eval do
        break 0 if line.text.empty? || !(whitespace = line.full[/^\s+/])

        if @indentation.nil?
          @indentation = whitespace

          if @indentation.include?(\s\) && @indentation.include?(\t\)
            raise SyntaxError.new(Error.message(:cant_use_tabs_and_spaces), line.index)
          end

          @flat_spaces = @indentation * (@template_tabs+1) if flat?
          break 1
        end

        tabs = whitespace.length / @indentation.length
        break tabs if whitespace == @indentation * tabs
        break @template_tabs + 1 if flat? && whitespace =~ /^#{@flat_spaces}/

        message = Error.message(:inconsistent_indentation,
          Haml::Util.human_indentation(whitespace),
          Haml::Util.human_indentation(@indentation)
        )
        raise SyntaxError.new(message, line.index)
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.