lib/code/object/dictionnary.rb in code-ruby-0.4.0 vs lib/code/object/dictionnary.rb in code-ruby-0.5.0

- old
+ new

@@ -8,21 +8,22 @@ end def call(**args) operator = args.fetch(:operator, nil) arguments = args.fetch(:arguments, []) - globals = args.multi_fetch(*::Code::GLOBALS) + globals = multi_fetch(args, *::Code::GLOBALS) + value = arguments.first&.value if operator == "values" sig(arguments) values elsif operator == "keys" sig(arguments) keys elsif operator == "each" - sig(arguments, ::Code::Object::Function) - each(arguments.first.value, **globals) + sig(arguments) { ::Code::Object::Function } + each(value, **globals) elsif key?(operator) result = fetch(operator) if result.is_a?(::Code::Object::Function) result.call(**args.merge(operator: nil)) @@ -80,12 +81,12 @@ def each(argument, **globals) raw.each do |key, value| argument.call( arguments: [ ::Code::Object::Argument.new(key), - ::Code::Object::Argument.new(value), + ::Code::Object::Argument.new(value) ], - **globals, + **globals ) end self end