Class: Metamagic::Tag
- Inherits:
-
Object
- Object
- Metamagic::Tag
- Defined in:
- lib/metamagic/tag.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
-
#initialize(context, key, value) ⇒ Tag
constructor
A new instance of Tag.
- #method_missing(*args) ⇒ Object
- #sort_order ⇒ Object
- #to_html ⇒ Object
Constructor Details
#initialize(context, key, value) ⇒ Tag
Returns a new instance of Tag.
5 6 7 |
# File 'lib/metamagic/tag.rb', line 5 def initialize(context, key, value) @context, @key, @value = context, key, value end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
25 26 27 |
# File 'lib/metamagic/tag.rb', line 25 def method_missing(*args) context.send(*args) end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
3 4 5 |
# File 'lib/metamagic/tag.rb', line 3 def context @context end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
3 4 5 |
# File 'lib/metamagic/tag.rb', line 3 def key @key end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/metamagic/tag.rb', line 3 def value @value end |
Instance Method Details
#<=>(other) ⇒ Object
21 22 23 |
# File 'lib/metamagic/tag.rb', line 21 def <=>(other) [sort_order, self.class.name] <=> [other.sort_order, other.class.name] end |
#==(other) ⇒ Object
17 18 19 |
# File 'lib/metamagic/tag.rb', line 17 def ==(other) self.class == other.class && self.key == other.key end |
#sort_order ⇒ Object
13 14 15 |
# File 'lib/metamagic/tag.rb', line 13 def sort_order 1000 end |
#to_html ⇒ Object
9 10 11 |
# File 'lib/metamagic/tag.rb', line 9 def to_html raise "#{self.class.name}#to_html must be overridden to render tag" end |