class Mio::Search

Public Class Methods

new(client) click to toggle source
# File lib/mio/search.rb, line 3
def initialize client
  @client = client
end

Public Instance Methods

all(resource, key, value) click to toggle source
# File lib/mio/search.rb, line 7
def all resource, key, value
  @client.find_all(resource)[resource].select{|o| o[key] == value}
end
method_missing(method_sym, *arguments, &block) click to toggle source
Calls superclass method
# File lib/mio/search.rb, line 11
def method_missing method_sym, *arguments, &block
  # the first argument is a Symbol, so you need to_s it if you want to pattern match
  if method_sym.to_s =~ /^find_(.*)_by_(.*)$/
    all($1, $2, arguments.first)
  else
    super
  end
end
respond_to?(method_sym, include_private=false) click to toggle source
Calls superclass method
# File lib/mio/search.rb, line 20
def respond_to? method_sym, include_private=false
  if method_sym.to_s =~ /^find_(.*)_by_(.*)$/
    true
  else
    super
  end
end