class Composed::Keywords

Public Class Methods

new() click to toggle source
# File lib/composed/keywords.rb, line 4
def initialize
  @injected = {}
end

Public Instance Methods

[]=(keyword, value) click to toggle source
# File lib/composed/keywords.rb, line 8
    def []=(keyword, value)
      raise ArgumentError, <<~ERROR if @injected.key?(keyword)
        Cannot inject keyword argument \"#{keyword}\" more than once."
      ERROR
      @injected[keyword] = value
    end
empty?() click to toggle source
# File lib/composed/keywords.rb, line 23
def empty?
  @injected.empty?
end
merge(args) click to toggle source
# File lib/composed/keywords.rb, line 15
def merge(args)
  @injected.each do |key, value|
    args[key] = value.call unless args.key?(key)
  end

  args
end