Class: RubyEventStore::Stream
- Inherits:
-
Object
- Object
- RubyEventStore::Stream
- Defined in:
- lib/ruby_event_store/stream.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other_stream) ⇒ Object (also: #eql?)
- #global? ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name) ⇒ Stream
constructor
A new instance of Stream.
Constructor Details
#initialize(name) ⇒ Stream
Returns a new instance of Stream.
3 4 5 6 |
# File 'lib/ruby_event_store/stream.rb', line 3 def initialize(name) raise IncorrectStreamData if !name.equal?(GLOBAL_STREAM) && (name.nil? || name.empty?) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/ruby_event_store/stream.rb', line 12 def name @name end |
Instance Method Details
#==(other_stream) ⇒ Object Also known as: eql?
22 23 24 25 |
# File 'lib/ruby_event_store/stream.rb', line 22 def ==(other_stream) other_stream.instance_of?(self.class) && other_stream.name.eql?(name) end |
#global? ⇒ Boolean
8 9 10 |
# File 'lib/ruby_event_store/stream.rb', line 8 def global? name.equal?(GLOBAL_STREAM) end |
#hash ⇒ Object
15 16 17 18 19 20 |
# File 'lib/ruby_event_store/stream.rb', line 15 def hash [ self.class, name ].hash ^ BIG_VALUE end |