Class: Chewy::Type::Crutch::Crutches
Instance Method Summary collapse
-
#initialize(type, collection) ⇒ Crutches
constructor
A new instance of Crutches.
Constructor Details
#initialize(type, collection) ⇒ Crutches
Returns a new instance of Crutches.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/chewy/type/crutch.rb', line 12 def initialize type, collection @type, @collection = type, collection @type._crutches.keys.each do |name| singleton_class.class_eval " def \#{name}\n @\#{name} ||= @type._crutches[:\#{name}].call @collection\n end\n METHOD\n end\nend\n", __FILE__, __LINE__ + 1 |