Sha256: 31eaa428fce9d726df3e6364fa1cafd43d789088ac4d86ebbba051d1405a450d

Contents?: true

Size: 606 Bytes

Versions: 2

Compression:

Stored size: 606 Bytes

Contents

class Module
  def attr_finder(*syms)
    syms.each do |sym|
      class_eval %{ def #{sym.to_s}(hash = nil)
                      if hash == nil
                        @#{sym.to_s}
                      else
                        @#{sym.to_s}.find_all do |t|
                          found = true
                          hash.each_key \{ |key|
                            found = false if t.send(key.to_sym) != hash[key]
                          \}
                          found
                        end
                      end
                    end
                  }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mechanize-0.4.6 lib/mechanize/module.rb
mechanize-0.4.7 lib/mechanize/module.rb