Class: Distribunaut::Tuple

Inherits:
Object
  • Object
show all
Defined in:
lib/distribunaut/tuple.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values = {}) ⇒ Tuple

Returns a new instance of Tuple.



10
11
12
13
14
# File 'lib/distribunaut/tuple.rb', line 10

def initialize(values = {})
  values.each do |k, v|
    self.send("#{k}=", v)
  end
end

Instance Attribute Details

#app_nameObject

Returns the value of attribute app_name.



4
5
6
# File 'lib/distribunaut/tuple.rb', line 4

def app_name
  @app_name
end

#descriptionObject

Returns the value of attribute description.



7
8
9
# File 'lib/distribunaut/tuple.rb', line 7

def description
  @description
end

#objectObject

Returns the value of attribute object.



6
7
8
# File 'lib/distribunaut/tuple.rb', line 6

def object
  @object
end

#spaceObject

Returns the value of attribute space.



5
6
7
# File 'lib/distribunaut/tuple.rb', line 5

def space
  @space
end

#timeoutObject

Returns the value of attribute timeout.



8
9
10
# File 'lib/distribunaut/tuple.rb', line 8

def timeout
  @timeout
end

Class Method Details

.from_array(ar) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/distribunaut/tuple.rb', line 30

def from_array(ar)
  tuple = Distribunaut::Tuple.new
  tuple.app_name = ar[0]
  tuple.space = ar[1]
  tuple.object = ar[2]
  tuple.description = ar[3]
  return tuple
end

Instance Method Details

#to_arrayObject



16
17
18
# File 'lib/distribunaut/tuple.rb', line 16

def to_array
  [self.app_name, self.space, self.object, self.description]
end

#to_sObject



24
25
26
# File 'lib/distribunaut/tuple.rb', line 24

def to_s
  self.to_array.inspect
end

#to_search_arrayObject



20
21
22
# File 'lib/distribunaut/tuple.rb', line 20

def to_search_array
  [self.app_name, self.space, nil, nil]
end