Class: Zinx::Match

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

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Match

Returns a new instance of Match.



210
211
212
# File 'lib/zinx.rb', line 210

def initialize(hash)
	@match = hash
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method) ⇒ Object



220
221
222
223
224
225
226
227
228
# File 'lib/zinx.rb', line 220

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

#eachObject



214
215
216
217
218
# File 'lib/zinx.rb', line 214

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