Sha256: c4c80dd0f058f98e5276d94d89ab8379194aecc5940bfb7d8117bb8b0f0f422a
Contents?: true
Size: 541 Bytes
Versions: 2
Compression:
Stored size: 541 Bytes
Contents
module Danica class Function < Common include ActiveModel::Model attr_accessor :name def initialize(*args) options = args.extract_options! super({ variables: args.flatten }.merge(options)) end def calculate(*args) vars_map = args.extract_options! vars_map = variables_value_hash.merge(vars_map) vars_map.each do |k, v| unless v && (v.is_a?(Integer) || v.valued?) vars_map[k] = args.shift end end self.class.new(vars_map).to_f end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
danica-2.0.5 | lib/danica/function.rb |
danica-2.0.4 | lib/danica/function.rb |