Class: ConvenientService::Config::Entities::Options
- Inherits:
-
Object
- Object
- ConvenientService::Config::Entities::Options
- Defined in:
- lib/convenient_service/config/entities/options.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #[](name) ⇒ Boolean
- #any? ⇒ Boolean
- #dup ⇒ ConvenientService::Config::Entities::Options
- #include?(name) ⇒ Boolean
- #initialize(options: nil) ⇒ void constructor
- #merge(other_options) ⇒ ConvenientService::Config::Entities::Options
- #replace(other_options) ⇒ ConvenientService::Config::Entities::Options
- #subtract(other_options) ⇒ ConvenientService::Config::Entities::Options
- #to_a ⇒ Array
Constructor Details
#initialize(options: nil) ⇒ void
22 23 24 |
# File 'lib/convenient_service/config/entities/options.rb', line 22 def initialize(options: nil) @options = Commands::NormalizeOptions[options: ] end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
16 17 18 |
# File 'lib/convenient_service/config/entities/options.rb', line 16 def @options end |
Instance Method Details
#[](name) ⇒ Boolean
47 48 49 |
# File 'lib/convenient_service/config/entities/options.rb', line 47 def [](name) [name] end |
#any? ⇒ Boolean
29 30 31 |
# File 'lib/convenient_service/config/entities/options.rb', line 29 def any? .any? { |_name, option| option.enabled? } end |
#dup ⇒ ConvenientService::Config::Entities::Options
54 55 56 |
# File 'lib/convenient_service/config/entities/options.rb', line 54 def dup self.class.new(options: .dup) end |
#include?(name) ⇒ Boolean
37 38 39 40 41 |
# File 'lib/convenient_service/config/entities/options.rb', line 37 def include?(name) return false unless .has_key?(name) [name].enabled? end |
#merge(other_options) ⇒ ConvenientService::Config::Entities::Options
61 62 63 64 65 |
# File 'lib/convenient_service/config/entities/options.rb', line 61 def merge() .merge!(Commands::NormalizeOptions[options: ]) self end |
#replace(other_options) ⇒ ConvenientService::Config::Entities::Options
79 80 81 82 83 |
# File 'lib/convenient_service/config/entities/options.rb', line 79 def replace() .replace(Commands::NormalizeOptions[options: ]) self end |
#subtract(other_options) ⇒ ConvenientService::Config::Entities::Options
70 71 72 73 74 |
# File 'lib/convenient_service/config/entities/options.rb', line 70 def subtract() Commands::NormalizeOptions[options: ].each_key { |name| .delete(name) } self end |
#to_a ⇒ Array
88 89 90 |
# File 'lib/convenient_service/config/entities/options.rb', line 88 def to_a .values end |