Module: EventStoreClient::Extensions::OptionsExtension::ClassMethods
- Defined in:
- lib/event_store_client/extensions/options_extension.rb
Instance Method Summary collapse
Instance Method Details
#inherited(klass) ⇒ Object
57 58 59 60 |
# File 'lib/event_store_client/extensions/options_extension.rb', line 57 def inherited(klass) super klass. = Set.new().freeze end |
#option(opt_name, &blk) ⇒ Symbol
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/event_store_client/extensions/options_extension.rb', line 45 def option(opt_name, &blk) self. = ( + Set.new([opt_name])).freeze attr_writer opt_name define_method opt_name do result = instance_variable_get(:"@#{opt_name}") return result if instance_variable_defined?(:"@#{opt_name}") instance_exec(&blk) if blk end end |