Class: FmRest::Spyke::Portal
- Inherits:
-
Spyke::Associations::HasMany
- Object
- Spyke::Associations::HasMany
- FmRest::Spyke::Portal
- Defined in:
- lib/fmrest/spyke/portal.rb
Overview
Extend Spyke's HasMany association with custom options
Instance Method Summary collapse
- #<<(*records) ⇒ Object (also: #push, #concat)
- #_remove_marked_for_destruction ⇒ Object
- #attribute_prefix ⇒ Object
-
#initialize(*args) ⇒ Portal
constructor
A new instance of Portal.
-
#parent_changes_applied ⇒ Object
Callback method, not meant to be used directly.
- #portal_key ⇒ Object
Constructor Details
#initialize(*args) ⇒ Portal
Returns a new instance of Portal.
8 9 10 11 12 13 |
# File 'lib/fmrest/spyke/portal.rb', line 8 def initialize(*args) super # Portals are always embedded, so no special URI @options[:uri] = "" end |
Instance Method Details
#<<(*records) ⇒ Object Also known as: push, concat
29 30 31 32 |
# File 'lib/fmrest/spyke/portal.rb', line 29 def <<(*records) records.flatten.each { |r| add_to_parent(r) } self end |
#_remove_marked_for_destruction ⇒ Object
36 37 38 |
# File 'lib/fmrest/spyke/portal.rb', line 36 def _remove_marked_for_destruction find_some.reject!(&:marked_for_destruction?) end |
#attribute_prefix ⇒ Object
19 20 21 |
# File 'lib/fmrest/spyke/portal.rb', line 19 def attribute_prefix (@options[:attribute_prefix] || portal_key).to_s end |
#parent_changes_applied ⇒ Object
Callback method, not meant to be used directly
25 26 27 |
# File 'lib/fmrest/spyke/portal.rb', line 25 def parent_changes_applied each(&:changes_applied) end |
#portal_key ⇒ Object
15 16 17 |
# File 'lib/fmrest/spyke/portal.rb', line 15 def portal_key (@options[:portal_key] || name).to_s end |