lib/pudl/entity.rb
# Reference a value by either passing it to a block
# or setting it in the context, depending on the type
# of the key
Reference a value by either passing it to a block
or setting it in the context, depending on the type
of the key
Reference a value by either passing it to a block or setting it in the context depending on the type of the key
def yield_to k, *args
        if k.is_a? Symbol
          if args.length > 1
            logger.debug "Cannot assign #{args.length} values to context key; using '#{args[0]}', discarding '#{args.join "', '"}'"
          end
          context.set k, args[0]
        elsif k.respond_to? :call
          context.instance_exec *args, &k
        else
          raise ArgumentError, "Invalid out property, #{k.class.name} should be symbol or block"
        end
      end
def yield_to k , * args if k . is_a? Symbol if args . length > 1 logger . debug "Cannot assign #{args.length} values to context key; using '#{args[0]}', discarding '#{args.join "', '"}'" end context . set k , args [ 0 ] elsif k . respond_to? :call context . instance_exec * args , & k else raise ArgumentError , "Invalid out property, #{k.class.name} should be symbol or block" end end
Reference a value by either passing it to a block
or setting it in the context, depending on the type
of the key
Reference a value by either passing it to a block or setting it in the context depending on the type of the key
k
<not_specific>
args
<not_specific>