Class: XDry::Node
- Inherits:
-
Object
- Object
- XDry::Node
- Defined in:
- lib/xdry/parsing/nodes.rb
Direct Known Subclasses
NClosingBrace, NDefine, NEnd, NFieldDef, NImplementationStart, NInterfaceFieldsEnd, NInterfaceStart, NLine, NMarker, NMethodEnd, NMethodHeader, NMethodStart, NOpeningBrace, NPropertyDef, NReleaseCall, NReturn, NSuperCall, NSynthesize
Instance Attribute Summary collapse
-
#indent ⇒ Object
Returns the value of attribute indent.
-
#pos ⇒ Object
Returns the value of attribute pos.
Instance Method Summary collapse
-
#initialize ⇒ Node
constructor
A new instance of Node.
- #method_missing(id, *args, &block) ⇒ Object
- #tagged_with?(tag) ⇒ Boolean
- #tags ⇒ Object
- #tags=(new_tags) ⇒ Object
- #tags_comment ⇒ Object
Constructor Details
#initialize ⇒ Node
Returns a new instance of Node.
7 8 9 |
# File 'lib/xdry/parsing/nodes.rb', line 7 def initialize @tags = Set.new end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(id, *args, &block) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/xdry/parsing/nodes.rb', line 27 def method_missing id, *args, &block if id.to_s =~ /^with_(.*)$/ send("#{$1}=", *args, &block) self else super(id, *args, &block) end end |
Instance Attribute Details
#indent ⇒ Object
Returns the value of attribute indent.
5 6 7 |
# File 'lib/xdry/parsing/nodes.rb', line 5 def indent @indent end |
#pos ⇒ Object
Returns the value of attribute pos.
5 6 7 |
# File 'lib/xdry/parsing/nodes.rb', line 5 def pos @pos end |
Instance Method Details
#tagged_with?(tag) ⇒ Boolean
19 20 21 |
# File 'lib/xdry/parsing/nodes.rb', line 19 def tagged_with? tag @tags.include? tag end |
#tags ⇒ Object
11 12 13 |
# File 'lib/xdry/parsing/nodes.rb', line 11 def @tags.dup end |
#tags=(new_tags) ⇒ Object
15 16 17 |
# File 'lib/xdry/parsing/nodes.rb', line 15 def @tags = Set.new() end |
#tags_comment ⇒ Object
23 24 25 |
# File 'lib/xdry/parsing/nodes.rb', line 23 def if @tags.empty? then "" else " // " + @tags.to_a.sort.join(", ") end end |