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.
5 6 7 8 |
# File 'lib/ruby_event_store/stream.rb', line 5 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.
14 15 16 |
# File 'lib/ruby_event_store/stream.rb', line 14 def name @name end |
Instance Method Details
#==(other_stream) ⇒ Object Also known as: eql?
20 21 22 |
# File 'lib/ruby_event_store/stream.rb', line 20 def ==(other_stream) other_stream.instance_of?(self.class) && other_stream.name.eql?(name) end |
#global? ⇒ Boolean
10 11 12 |
# File 'lib/ruby_event_store/stream.rb', line 10 def global? name.equal?(GLOBAL_STREAM) end |
#hash ⇒ Object
16 17 18 |
# File 'lib/ruby_event_store/stream.rb', line 16 def hash name.hash ^ self.class.hash end |