Class: Catlogic::Distribution

Inherits:
Object
  • Object
show all
Defined in:
lib/catlogic/distribution.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(distribution) ⇒ Distribution

Returns a new instance of Distribution.



5
6
7
# File 'lib/catlogic/distribution.rb', line 5

def initialize(distribution)
  @label = distribution
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



3
4
5
# File 'lib/catlogic/distribution.rb', line 3

def label
  @label
end

Instance Method Details

#oppositeObject



9
10
11
12
13
14
15
16
# File 'lib/catlogic/distribution.rb', line 9

def opposite
  if self.label == 'distributed'
    opposite = Distribution.new('undistributed')
  elsif self.label == 'undistributed'
    opposite = Distribution.new('distributed')
  end
  return opposite
end