Class: Zinx::Match
- Inherits:
-
Object
- Object
- Zinx::Match
- Defined in:
- lib/zinx.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(hash) ⇒ Match
constructor
A new instance of Match.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(hash) ⇒ Match
Returns a new instance of Match.
207 208 209 |
# File 'lib/zinx.rb', line 207 def initialize(hash) @match = hash end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
217 218 219 220 221 222 223 224 225 |
# File 'lib/zinx.rb', line 217 def method_missing(method, *args, &block) 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 ⇒ Object
211 212 213 214 215 |
# File 'lib/zinx.rb', line 211 def each @match.each do |m| yield m end end |