Method: Hackeroo::Cursor#initialize
- Defined in:
- lib/hackeroo/cursor.rb
#initialize(attrs, collection_name, klass, client, method_name, method_options) ⇒ Hackeroo::Cursor
Initializes a new Cursor
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/hackeroo/cursor.rb', line 31 def initialize(attrs, collection_name, klass, client, method_name, ) @attrs = attrs @client = client @method_name = method_name @method_options = @collection = Array(attrs[collection_name.to_sym]).map do |item| if klass klass.fetch_or_new(item) else item end end singleton_class.class_eval do alias_method(collection_name.to_sym, :collection) end end |