Module: ActiveResource::Extend::Singleton::ClassMethods
- Defined in:
- lib/ares/add_singleton.rb
Instance Method Summary collapse
- #collection_name_with_singleton ⇒ Object
- #find_one_with_singleton(options) ⇒ Object
- #singleton ⇒ Object
- #singleton=(singleton) ⇒ Object
Instance Method Details
#collection_name_with_singleton ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/ares/add_singleton.rb', line 41 def collection_name_with_singleton if singleton element_name else collection_name_without_singleton end end |
#find_one_with_singleton(options) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/ares/add_singleton.rb', line 31 def find_one_with_singleton() found_object = find_one_without_singleton() if !found_object && singleton , = ([:params]) path = element_path(nil, , ) found_object = instantiate_record(format.decode(connection.get(path, headers).body), ) end found_object end |
#singleton ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ares/add_singleton.rb', line 16 def singleton # Not using superclass_delegating_reader. See +site+ for explanation if defined?(@singleton) @singleton elsif superclass != Object && superclass.singleton superclass.singleton.dup.freeze else @singleton = false end end |
#singleton=(singleton) ⇒ Object
27 28 29 |
# File 'lib/ares/add_singleton.rb', line 27 def singleton=(singleton) @singleton = singleton end |