Module: Rubysierung::Core

Included in:
Rubysierung
Defined in:
lib/rubysierung/core.rb

Instance Method Summary collapse

Instance Method Details

#call(klass_hash:, value_hash:) ⇒ Hash<Symbol, Constant>

applies conversion methods on args and returns args(for CallBaecker)

Parameters:

  • klass_hash (Hash<Symbol, Constant>)

    holds types for Arguments

  • value_hash (Hash<Symbol, Constant>)

    holds values for Arguments

Returns:

  • (Hash<Symbol, Constant>)

    same as value_hash only that on its values the type was applied and merged with the other values



20
21
22
23
24
25
26
# File 'lib/rubysierung/core.rb', line 20

def call(klass_hash:, value_hash:)
  return value_hash if klass_hash.empty?
  return_hash = each_param(klass_hash, value_hash) do |key|
    @__error_data[:var_sym] = key
  end
  value_hash.merge return_hash
end

#default_hash(ast) ⇒ Hash<Symbol, Constant>

TODO:

refactor into adapter

sets defaults as @__defaults

Parameters:

  • ast (AST)

    an instance of modefied ruby ast class

Returns:

  • (Hash<Symbol, Constant>)


9
10
11
12
13
# File 'lib/rubysierung/core.rb', line 9

def default_hash(ast)
  param_hash, defaults = ast.method.params
  @__defaults = @__defaults.merge(defaults)
  convert_value_to_constant param_hash
end