Class: BaseEnvelope
- Inherits:
-
Object
- Object
- BaseEnvelope
- Defined in:
- lib/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.
34 35 36 |
# File 'lib/envelope.rb', line 34 def initialize @count = 0 end |
Instance Attribute Details
#count ⇒ Object (readonly)
count of added values reader.
31 32 33 |
# File 'lib/envelope.rb', line 31 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.
24 25 26 27 28 |
# File 'lib/envelope.rb', line 24 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.
18 19 20 |
# File 'lib/envelope.rb', line 18 def raise_no_envelope raise EnvelopeException, "No values are enveloped" end |