Class: Eymiha::BaseEnvelope

Inherits:
Object
  • Object
show all
Defined in:
lib/eymiha/util/envelope.rb

Overview

A BaseEnvelope provides a means to keep and provide a count of objects that have been added to an envelope.

Direct Known Subclasses

Envelope

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBaseEnvelope

Returns a new instance with no values added.



36
37
38
# File 'lib/eymiha/util/envelope.rb', line 36

def initialize
  @count = 0
end

Instance Attribute Details

#countObject (readonly)

count of added values reader.



33
34
35
# File 'lib/eymiha/util/envelope.rb', line 33

def count
  @count
end

Instance Method Details

#raise_no_compare(value = nil) ⇒ Object

Called when the value cannot be compared with the the boundaries of the instance.

Raises:



26
27
28
29
30
# File 'lib/eymiha/util/envelope.rb', line 26

def raise_no_compare(value=nil)
  value = "'#{value}' " unless value == nil
  raise EnvelopeException,
  "The value #{value}cannot be compared with the envelope"
end

#raise_no_envelopeObject

Called when requesting envelope bounderies before any values have been added.

Raises:



20
21
22
# File 'lib/eymiha/util/envelope.rb', line 20

def raise_no_envelope
  raise EnvelopeException, "No values are enveloped"
end