Class: RGen::Util::PatternMatcher::Bindable
Instance Method Summary
collapse
#_set_container
Constructor Details
Returns a new instance of Bindable.
101
102
103
104
105
|
# File 'lib/rgen/util/pattern_matcher.rb', line 101
def initialize
@bound = false
@value = nil
@many = false
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args) ⇒ Object
128
129
130
131
|
# File 'lib/rgen/util/pattern_matcher.rb', line 128
def method_missing(m, *args)
raise "bindable not bound" unless _bound?
@value.send(m, *args)
end
|
Instance Method Details
#_bind(value) ⇒ Object
112
113
114
115
|
# File 'lib/rgen/util/pattern_matcher.rb', line 112
def _bind(value)
@value = value
@bound = true
end
|
#_bound? ⇒ Boolean
106
107
108
|
# File 'lib/rgen/util/pattern_matcher.rb', line 106
def _bound?
@bound
end
|
#_many? ⇒ Boolean
109
110
111
|
# File 'lib/rgen/util/pattern_matcher.rb', line 109
def _many?
@many
end
|
#_value ⇒ Object
116
117
118
|
# File 'lib/rgen/util/pattern_matcher.rb', line 116
def _value
@value
end
|
#each {|_self| ... } ⇒ Object
pretend this is an enumerable which contains itself, so the bindable can be inserted into many-features, when this is done the bindable is marked as a many-bindable
124
125
126
127
|
# File 'lib/rgen/util/pattern_matcher.rb', line 124
def each
@many = true
yield(self)
end
|
#to_s ⇒ Object
119
120
121
|
# File 'lib/rgen/util/pattern_matcher.rb', line 119
def to_s
@value.to_s
end
|