Class: Cockroach::Source::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/cockroach/source/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ Node

Returns a new instance of Node.



6
7
8
# File 'lib/cockroach/source/node.rb', line 6

def initialize node
  @node = node
end

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



4
5
6
# File 'lib/cockroach/source/node.rb', line 4

def node
  @node
end

Instance Method Details

#sampleObject

Returns a random record, among generated.



11
12
13
14
15
# File 'lib/cockroach/source/node.rb', line 11

def sample
  return nil if node.ids.empty?
  id = node.ids.sample
  find id
end