Class: PgEventstore::Extensions::OptionsExtension::Options
- Inherits:
-
Object
- Object
- PgEventstore::Extensions::OptionsExtension::Options
- Includes:
- Enumerable
- Defined in:
- lib/pg_eventstore/extensions/options_extension.rb
Instance Method Summary collapse
- #+(other) ⇒ PgEventstore::Extensions::OptionsExtension::Options
- #==(other) ⇒ Object
- #[](option_name) ⇒ PgEventstore::Extensions::OptionsExtension::Option?
- #dup ⇒ Boolean
- #each ⇒ Object
- #include?(option) ⇒ Boolean
-
#initialize(options = []) ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize(options = []) ⇒ Options
Returns a new instance of Options.
80 81 82 |
# File 'lib/pg_eventstore/extensions/options_extension.rb', line 80 def initialize( = []) = .to_h { [_1, true] } end |
Instance Method Details
#+(other) ⇒ PgEventstore::Extensions::OptionsExtension::Options
93 94 95 |
# File 'lib/pg_eventstore/extensions/options_extension.rb', line 93 def +(other) self.class.new(.keys + other..keys) end |
#==(other) ⇒ Object
112 113 114 |
# File 'lib/pg_eventstore/extensions/options_extension.rb', line 112 def ==(other) .keys == other..keys end |
#[](option_name) ⇒ PgEventstore::Extensions::OptionsExtension::Option?
86 87 88 89 |
# File 'lib/pg_eventstore/extensions/options_extension.rb', line 86 def [](option_name) option = Option.new(option_name) .find { |key, _| key == option }&.dig(0) end |
#dup ⇒ Boolean
104 105 106 |
# File 'lib/pg_eventstore/extensions/options_extension.rb', line 104 def dup self.class.new(.keys) end |
#each ⇒ Object
108 109 110 |
# File 'lib/pg_eventstore/extensions/options_extension.rb', line 108 def each(...) .keys.each(...) end |
#include?(option) ⇒ Boolean
99 100 101 |
# File 'lib/pg_eventstore/extensions/options_extension.rb', line 99 def include?(option) .key?(option) end |