Class: Synchronisable::Input::Descriptor 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) ⇒ 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

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


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.

Returns:

  • (Boolean)

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


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.

Returns:

  • (Boolean)

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.

Returns:

  • (Boolean)

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.

Returns:

  • (Boolean)

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.

Returns:

  • (Boolean)

24
25
26
# File 'lib/synchronisable/input/descriptor.rb', line 24

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