Class: Curly::Parser::Component
- Inherits:
-
Object
- Object
- Curly::Parser::Component
- Defined in:
- lib/curly/parser.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#contexts ⇒ Object
readonly
Returns the value of attribute contexts.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, identifier = nil, attributes = {}, contexts = []) ⇒ Component
constructor
A new instance of Component.
- #to_s ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(name, identifier = nil, attributes = {}, contexts = []) ⇒ Component
Returns a new instance of Component.
8 9 10 |
# File 'lib/curly/parser.rb', line 8 def initialize(name, identifier = nil, attributes = {}, contexts = []) @name, @identifier, @attributes, @contexts = name, identifier, attributes, contexts end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/curly/parser.rb', line 6 def attributes @attributes end |
#contexts ⇒ Object (readonly)
Returns the value of attribute contexts.
6 7 8 |
# File 'lib/curly/parser.rb', line 6 def contexts @contexts end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
6 7 8 |
# File 'lib/curly/parser.rb', line 6 def identifier @identifier end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/curly/parser.rb', line 6 def name @name end |
Instance Method Details
#==(other) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/curly/parser.rb', line 16 def ==(other) other.name == name && other.identifier == identifier && other.attributes == attributes && other.contexts == contexts end |
#to_s ⇒ Object
12 13 14 |
# File 'lib/curly/parser.rb', line 12 def to_s contexts.map {|c| c + ":" }.join << [name, identifier].compact.join(".") end |
#type ⇒ Object
23 24 25 |
# File 'lib/curly/parser.rb', line 23 def type :component end |