Class: Curly::Parser::Block

Inherits:
Object
  • Object
show all
Defined in:
lib/curly/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, component, nodes = []) ⇒ Block



75
76
77
# File 'lib/curly/parser.rb', line 75

def initialize(type, component, nodes = [])
  @type, @component, @nodes = type, component, nodes
end

Instance Attribute Details

#componentObject (readonly)

Returns the value of attribute component



73
74
75
# File 'lib/curly/parser.rb', line 73

def component
  @component
end

#nodesObject (readonly)

Returns the value of attribute nodes



73
74
75
# File 'lib/curly/parser.rb', line 73

def nodes
  @nodes
end

#typeObject (readonly)

Returns the value of attribute type



73
74
75
# File 'lib/curly/parser.rb', line 73

def type
  @type
end

Instance Method Details

#<<(node) ⇒ Object



89
90
91
# File 'lib/curly/parser.rb', line 89

def <<(node)
  @nodes << node
end

#==(other) ⇒ Object



93
94
95
96
97
# File 'lib/curly/parser.rb', line 93

def ==(other)
  other.type == type &&
    other.component == component &&
    other.nodes == nodes
end

#closed_by?(component) ⇒ Boolean



79
80
81
82
83
# File 'lib/curly/parser.rb', line 79

def closed_by?(component)
  self.component.name == component.name &&
    self.component.identifier == component.identifier &&
    self.component.contexts == component.contexts
end

#to_sObject



85
86
87
# File 'lib/curly/parser.rb', line 85

def to_s
  component.to_s
end