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
- #==(other) ⇒ Boolean?
- #[](name) ⇒ Boolean
- #any? ⇒ Boolean
- #dup ⇒ ConvenientService::Config::Entities::Options
- #include?(name) ⇒ Boolean
- #initialize(options: nil) ⇒ void constructor
- #keys ⇒ Array<Symbol>
- #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
26 27 28 |
# File 'lib/convenient_service/config/entities/options.rb', line 26 def initialize(options: nil) @options = Commands::NormalizeOptions[options: ] end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
20 21 22 |
# File 'lib/convenient_service/config/entities/options.rb', line 20 def @options end |
Instance Method Details
#==(other) ⇒ Boolean?
103 104 105 106 107 108 109 |
# File 'lib/convenient_service/config/entities/options.rb', line 103 def ==(other) return unless other.instance_of?(self.class) return false if != other. true end |
#[](name) ⇒ Boolean
58 59 60 |
# File 'lib/convenient_service/config/entities/options.rb', line 58 def [](name) [name] end |
#any? ⇒ Boolean
40 41 42 |
# File 'lib/convenient_service/config/entities/options.rb', line 40 def any? .any? { |_name, option| option.enabled? } end |
#dup ⇒ ConvenientService::Config::Entities::Options
65 66 67 |
# File 'lib/convenient_service/config/entities/options.rb', line 65 def dup self.class.new(options: .dup) end |
#include?(name) ⇒ Boolean
48 49 50 51 52 |
# File 'lib/convenient_service/config/entities/options.rb', line 48 def include?(name) return false unless .has_key?(name) [name].enabled? end |
#keys ⇒ Array<Symbol>
33 34 35 |
# File 'lib/convenient_service/config/entities/options.rb', line 33 def keys .keys end |
#merge(other_options) ⇒ ConvenientService::Config::Entities::Options
72 73 74 75 76 |
# File 'lib/convenient_service/config/entities/options.rb', line 72 def merge() .merge!(Commands::NormalizeOptions[options: ]) self end |
#replace(other_options) ⇒ ConvenientService::Config::Entities::Options
90 91 92 93 94 |
# File 'lib/convenient_service/config/entities/options.rb', line 90 def replace() .replace(Commands::NormalizeOptions[options: ]) self end |
#subtract(other_options) ⇒ ConvenientService::Config::Entities::Options
81 82 83 84 85 |
# File 'lib/convenient_service/config/entities/options.rb', line 81 def subtract() Commands::NormalizeOptions[options: ].each_key { |name| .delete(name) } self end |
#to_a ⇒ Array
114 115 116 |
# File 'lib/convenient_service/config/entities/options.rb', line 114 def to_a .values end |