Class: HamlParser::Ast::Element

Inherits:
Struct
  • Object
show all
Includes:
HasChildren
Defined in:
lib/haml_parser/ast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HasChildren

#<<

Constructor Details

#initializeElement

Returns a new instance of Element.



47
48
49
50
51
52
53
54
55
# File 'lib/haml_parser/ast.rb', line 47

def initialize(*)
  super
  self.static_class ||= ''
  self.static_id ||= ''
  self.attributes ||= ''
  self.self_closing ||= false
  self.nuke_inner_whitespace ||= false
  self.nuke_outer_whitespace ||= false
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes

Returns:

  • (Object)

    the current value of attributes



32
33
34
# File 'lib/haml_parser/ast.rb', line 32

def attributes
  @attributes
end

#childrenObject

Returns the value of attribute children

Returns:

  • (Object)

    the current value of children



32
33
34
# File 'lib/haml_parser/ast.rb', line 32

def children
  @children
end

#filenameObject

Returns the value of attribute filename

Returns:

  • (Object)

    the current value of filename



32
33
34
# File 'lib/haml_parser/ast.rb', line 32

def filename
  @filename
end

#linenoObject

Returns the value of attribute lineno

Returns:

  • (Object)

    the current value of lineno



32
33
34
# File 'lib/haml_parser/ast.rb', line 32

def lineno
  @lineno
end

#nuke_inner_whitespaceObject

Returns the value of attribute nuke_inner_whitespace

Returns:

  • (Object)

    the current value of nuke_inner_whitespace



32
33
34
# File 'lib/haml_parser/ast.rb', line 32

def nuke_inner_whitespace
  @nuke_inner_whitespace
end

#nuke_outer_whitespaceObject

Returns the value of attribute nuke_outer_whitespace

Returns:

  • (Object)

    the current value of nuke_outer_whitespace



32
33
34
# File 'lib/haml_parser/ast.rb', line 32

def nuke_outer_whitespace
  @nuke_outer_whitespace
end

#oneline_childObject

Returns the value of attribute oneline_child

Returns:

  • (Object)

    the current value of oneline_child



32
33
34
# File 'lib/haml_parser/ast.rb', line 32

def oneline_child
  @oneline_child
end

#self_closingObject

Returns the value of attribute self_closing

Returns:

  • (Object)

    the current value of self_closing



32
33
34
# File 'lib/haml_parser/ast.rb', line 32

def self_closing
  @self_closing
end

#static_classObject

Returns the value of attribute static_class

Returns:

  • (Object)

    the current value of static_class



32
33
34
# File 'lib/haml_parser/ast.rb', line 32

def static_class
  @static_class
end

#static_idObject

Returns the value of attribute static_id

Returns:

  • (Object)

    the current value of static_id



32
33
34
# File 'lib/haml_parser/ast.rb', line 32

def static_id
  @static_id
end

#tag_nameObject

Returns the value of attribute tag_name

Returns:

  • (Object)

    the current value of tag_name



32
33
34
# File 'lib/haml_parser/ast.rb', line 32

def tag_name
  @tag_name
end

Instance Method Details

#to_hObject



57
58
59
60
61
62
# File 'lib/haml_parser/ast.rb', line 57

def to_h
  super.merge(
    type: 'element',
    oneline_child: oneline_child && oneline_child.to_h,
  )
end