Class: Solid::Result::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/solid/result/config.rb,
lib/solid/result/config/options.rb,
lib/solid/result/config/switcher.rb,
lib/solid/result/config/switchers/addons.rb,
lib/solid/result/config/switchers/features.rb,
lib/solid/result/config/switchers/constant_aliases.rb,
lib/solid/result/config/switchers/pattern_matching.rb

Defined Under Namespace

Modules: Options

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



14
15
16
17
18
19
20
# File 'lib/solid/result/config.rb', line 14

def initialize
  @addon = Addons.switcher
  @feature = Features.switcher
  @constant_alias = ConstantAliases.switcher
  @pattern_matching = PatternMatching.switcher
  @and_then_ = CallableAndThen::Config.new
end

Instance Attribute Details

#addonObject (readonly)

Returns the value of attribute addon.



12
13
14
# File 'lib/solid/result/config.rb', line 12

def addon
  @addon
end

#constant_aliasObject (readonly)

Returns the value of attribute constant_alias.



12
13
14
# File 'lib/solid/result/config.rb', line 12

def constant_alias
  @constant_alias
end

#featureObject (readonly)

Returns the value of attribute feature.



12
13
14
# File 'lib/solid/result/config.rb', line 12

def feature
  @feature
end

#pattern_matchingObject (readonly)

Returns the value of attribute pattern_matching.



12
13
14
# File 'lib/solid/result/config.rb', line 12

def pattern_matching
  @pattern_matching
end

Instance Method Details

#and_then!Object



26
27
28
# File 'lib/solid/result/config.rb', line 26

def and_then!
  @and_then_
end

#event_logsObject



22
23
24
# File 'lib/solid/result/config.rb', line 22

def event_logs
  EventLogs::Config.instance
end

#freezeObject



30
31
32
33
34
35
36
37
38
39
# File 'lib/solid/result/config.rb', line 30

def freeze
  addon.freeze
  feature.freeze
  constant_alias.freeze
  pattern_matching.freeze
  and_then!.freeze
  event_logs.freeze

  super
end

#inspectObject



54
55
56
57
58
# File 'lib/solid/result/config.rb', line 54

def inspect
  "#<#{self.class.name} " \
    "options=#{options.keys.sort.inspect} " \
    "and_then!=#{and_then!.options.inspect}>"
end

#optionsObject



41
42
43
44
45
46
47
48
# File 'lib/solid/result/config.rb', line 41

def options
  {
    addon: addon,
    feature: feature,
    constant_alias: constant_alias,
    pattern_matching: pattern_matching
  }
end

#to_hObject



50
51
52
# File 'lib/solid/result/config.rb', line 50

def to_h
  options.transform_values(&:to_h)
end