Class: GoogleContacts::Wrapper::CollectionProxy
- Inherits:
-
Object
- Object
- GoogleContacts::Wrapper::CollectionProxy
- Defined in:
- lib/google_contacts/wrapper.rb
Instance Method Summary collapse
- #build(attributes = {}) ⇒ Object
-
#find(what, options = {}) ⇒ Object
:what - all, ID, whatever, currently unused.
-
#initialize(wrapper, klass) ⇒ CollectionProxy
constructor
A new instance of CollectionProxy.
Constructor Details
#initialize(wrapper, klass) ⇒ CollectionProxy
Returns a new instance of CollectionProxy.
118 119 120 121 122 |
# File 'lib/google_contacts/wrapper.rb', line 118 def initialize(wrapper, klass) @wrapper = wrapper @klass = klass @collection = klass.name.split("::").last.downcase + "s" end |
Instance Method Details
#build(attributes = {}) ⇒ Object
131 132 133 134 135 |
# File 'lib/google_contacts/wrapper.rb', line 131 def build(attributes = {}) @klass.new(@wrapper).tap do |instance| instance.attributes = attributes end end |
#find(what, options = {}) ⇒ Object
:what - all, ID, whatever, currently unused
125 126 127 128 129 |
# File 'lib/google_contacts/wrapper.rb', line 125 def find(what, = {}) @wrapper.find(@collection, ) do |entry| @klass.new(@wrapper, entry) end end |