Class: Eymiha::BaseEnvelope
- Inherits:
-
Object
- Object
- Eymiha::BaseEnvelope
- 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
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
count of added values reader.
Instance Method Summary collapse
-
#initialize ⇒ BaseEnvelope
constructor
Returns a new instance with no values added.
-
#raise_no_compare(value = nil) ⇒ Object
Called when the value cannot be compared with the the boundaries of the instance.
-
#raise_no_envelope ⇒ Object
Called when requesting envelope bounderies before any values have been added.
Constructor Details
#initialize ⇒ BaseEnvelope
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
#count ⇒ Object (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.
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_envelope ⇒ Object
Called when requesting envelope bounderies before any values have been added.
20 21 22 |
# File 'lib/eymiha/util/envelope.rb', line 20 def raise_no_envelope raise EnvelopeException, "No values are enveloped" end |