Class: Stave::Core::OptionMerger

Inherits:
Object
  • Object
show all
Defined in:
lib/stave/core/option_merger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, options) ⇒ OptionMerger

Returns a new instance of OptionMerger.



6
7
8
9
# File 'lib/stave/core/option_merger.rb', line 6

def initialize(context, options)
  @context = context
  @options = options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, **kwargs) ⇒ Object (private)



13
14
15
16
17
18
# File 'lib/stave/core/option_merger.rb', line 13

def method_missing(method, *args, **kwargs, &)
  kwargs ||= {}
  kwargs = kwargs.merge(options) unless options.empty?

  context.send(method, *args, **kwargs, &)
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



4
5
6
# File 'lib/stave/core/option_merger.rb', line 4

def context
  @context
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/stave/core/option_merger.rb', line 4

def options
  @options
end