Class: Synchronisable::InputDescriptor
- Inherits:
-
Object
- Object
- Synchronisable::InputDescriptor
- Defined in:
- lib/synchronisable/input_descriptor.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #array_of_ids? ⇒ Boolean
- #element_class ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(data) ⇒ InputDescriptor
constructor
A new instance of InputDescriptor.
- #local_id? ⇒ Boolean
- #remote_id? ⇒ Boolean
Constructor Details
#initialize(data) ⇒ InputDescriptor
5 6 7 |
# File 'lib/synchronisable/input_descriptor.rb', line 5 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/synchronisable/input_descriptor.rb', line 3 def data @data end |
Instance Method Details
#array_of_ids? ⇒ Boolean
21 22 23 24 25 26 |
# File 'lib/synchronisable/input_descriptor.rb', line 21 def array_of_ids? enumerable? && ( first_element.is_a?(String) || first_element.is_a?(Integer) ) end |
#element_class ⇒ Object
28 29 30 |
# File 'lib/synchronisable/input_descriptor.rb', line 28 def element_class first_element.try(:class) end |
#empty? ⇒ Boolean
9 10 11 |
# File 'lib/synchronisable/input_descriptor.rb', line 9 def empty? @data.blank? end |
#local_id? ⇒ Boolean
17 18 19 |
# File 'lib/synchronisable/input_descriptor.rb', line 17 def local_id? @data.is_a?(Integer) end |
#remote_id? ⇒ Boolean
13 14 15 |
# File 'lib/synchronisable/input_descriptor.rb', line 13 def remote_id? @data.is_a?(String) end |