Module: SmoothOperator::Options

Included in:
OpenStruct
Defined in:
lib/smooth_operator/options.rb

Instance Method Summary collapse

Instance Method Details

#config_optionsObject



19
20
21
# File 'lib/smooth_operator/options.rb', line 19

def config_options
  Helpers.get_instance_variable(self, :config_options, {})
end

#get_option(option, default, *args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/smooth_operator/options.rb', line 4

def get_option(option, default, *args)
  return default unless config_options.include?(option)

  _option = config_options[option]

  case _option
  when Symbol
    respond_to?(_option) ? send(_option, *args) : _option
  when Proc
    _option.call(*args)
  else
    _option
  end
end

#smooth_operator_options(options = {}) ⇒ Object Also known as: options



23
24
25
# File 'lib/smooth_operator/options.rb', line 23

def smooth_operator_options(options = {})
  config_options.merge!(options)
end