class RakeFactory::DynamicValue

Public Class Methods

new(pre_arguments = [], post_arguments = [], &block) click to toggle source
# File lib/rake_factory/values.rb, line 24
def initialize(pre_arguments = [], post_arguments = [], &block)
  @block = block
  @pre_arguments = pre_arguments
  @post_arguments = post_arguments
end

Public Instance Methods

append_argument(argument) click to toggle source
# File lib/rake_factory/values.rb, line 34
def append_argument(argument)
  self.class.new(@pre_arguments, [*@post_arguments, argument], &@block)
end
evaluate(arguments) click to toggle source
# File lib/rake_factory/values.rb, line 38
def evaluate(arguments)
  resolved_arguments = [*@pre_arguments, *arguments, *@post_arguments]
  @block.call(*resolved_arguments.slice(0, @block.arity))
end
prepend_argument(argument) click to toggle source
# File lib/rake_factory/values.rb, line 30
def prepend_argument(argument)
  self.class.new([argument, *@pre_arguments], @post_arguments, &@block)
end