Class: XDry::Node
- Inherits:
-
Object
show all
- 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
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ 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
|
11
12
13
|
# File 'lib/xdry/parsing/nodes.rb', line 11
def tags
@tags.dup
end
|
15
16
17
|
# File 'lib/xdry/parsing/nodes.rb', line 15
def tags= new_tags
@tags = Set.new(new_tags)
end
|
23
24
25
|
# File 'lib/xdry/parsing/nodes.rb', line 23
def
if @tags.empty? then "" else " // " + @tags.to_a.sort.join(", ") end
end
|