class Faceter::Nodes::Create

The node describes creating a new value from values by keys

@api private

Public Instance Methods

transproc() click to toggle source

Transformer function, defined by the node

@return [Transproc::Function]

# File lib/faceter/nodes/create.rb, line 18
def transproc
  Functions[__fn__]
end

Private Instance Methods

__fn__() click to toggle source
# File lib/faceter/nodes/create.rb, line 24
def __fn__
  return __proc__ unless name
  -> hash { hash.merge(name => __proc__[hash]) }
end
__proc__() click to toggle source
# File lib/faceter/nodes/create.rb, line 29
def __proc__
  return __values__ unless block
  -> hash { block[*__values__[hash]] }
end
__values__() click to toggle source
# File lib/faceter/nodes/create.rb, line 34
def __values__
  return -> hash { hash.fetch(keys) } unless keys.instance_of?(Array)
  -> hash { hash.values_at(*keys) }
end