Class: Synchronisable::InputDescriptor Private

Inherits:
Object
  • Object
show all
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.

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ InputDescriptor

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 InputDescriptor.



11
12
13
# File 'lib/synchronisable/input_descriptor.rb', line 11

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (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.



9
10
11
# File 'lib/synchronisable/input_descriptor.rb', line 9

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.

Returns:

  • (Boolean)


31
32
33
34
35
36
# File 'lib/synchronisable/input_descriptor.rb', line 31

def array_of_ids?
   enumerable? && (
    first_element.is_a?(String) ||
    first_element.is_a?(Integer)
  )
end

#element_classObject

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.



38
39
40
# File 'lib/synchronisable/input_descriptor.rb', line 38

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.

Returns:

  • (Boolean)


15
16
17
# File 'lib/synchronisable/input_descriptor.rb', line 15

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.

Returns:

  • (Boolean)


27
28
29
# File 'lib/synchronisable/input_descriptor.rb', line 27

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.

Returns:

  • (Boolean)


19
20
21
# File 'lib/synchronisable/input_descriptor.rb', line 19

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.

Returns:

  • (Boolean)


23
24
25
# File 'lib/synchronisable/input_descriptor.rb', line 23

def remote_id?
  @data.is_a?(String)
end