Class: Zinx::Match

Inherits:
Object
  • Object
show all
Defined in:
lib/zinx.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ 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

#eachObject



211
212
213
214
215
# File 'lib/zinx.rb', line 211

def each
  @match.each do |m|
    yield m
  end
end