Class: Zinx::Match
- Inherits:
-
Object
- Object
- Zinx::Match
- Defined in:
- lib/zinx.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(hash) ⇒ Match
constructor
A new instance of Match.
- #method_missing(method) ⇒ Object
Constructor Details
#initialize(hash) ⇒ Match
Returns a new instance of Match.
211 212 213 |
# File 'lib/zinx.rb', line 211 def initialize(hash) @match = hash end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
221 222 223 224 225 226 227 228 229 |
# File 'lib/zinx.rb', line 221 def method_missing(method) if ['groupby', 'count', 'expr'].include?("#{method}") @match["attrs"]["@#{method}"] elsif ['id', 'weight', 'attrs'].include?("#{method}") @match["#{method}"] else @match["attrs"]["#{method}"] end end |
Instance Method Details
#each(&block) ⇒ Object
215 216 217 218 219 |
# File 'lib/zinx.rb', line 215 def each(&block) @match.each do |m| block.call m end end |