Class: Synchronisable::Input::Descriptor Private
- Defined in:
- lib/synchronisable/input/descriptor.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Provides a set of helper methods to describe user input.
Instance Attribute Summary collapse
- #data ⇒ Object readonly private
Instance Method Summary collapse
- #array_of_ids? ⇒ Boolean private
- #element_class ⇒ Object private
- #empty? ⇒ Boolean private
-
#initialize(data) ⇒ Descriptor
constructor
private
A new instance of Descriptor.
- #local_id? ⇒ Boolean private
- #params? ⇒ Boolean private
- #remote_id? ⇒ Boolean private
Constructor Details
#initialize(data) ⇒ Descriptor
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Descriptor.
12 13 14 |
# File 'lib/synchronisable/input/descriptor.rb', line 12 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/synchronisable/input/descriptor.rb', line 10 def data @data end |
Instance Method Details
#array_of_ids? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 35 36 37 |
# File 'lib/synchronisable/input/descriptor.rb', line 32 def array_of_ids? enumerable? && ( first_element.is_a?(String) || first_element.is_a?(Integer) ) end |
#element_class ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/synchronisable/input/descriptor.rb', line 39 def element_class first_element.try(:class) end |
#empty? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 |
# File 'lib/synchronisable/input/descriptor.rb', line 16 def empty? @data.blank? end |
#local_id? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 |
# File 'lib/synchronisable/input/descriptor.rb', line 28 def local_id? @data.is_a?(Integer) end |
#params? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 |
# File 'lib/synchronisable/input/descriptor.rb', line 20 def params? @data.is_a?(Hash) end |
#remote_id? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/synchronisable/input/descriptor.rb', line 24 def remote_id? @data.is_a?(String) end |