Sha256: c7f738d97ec6c3809f06c48eb92fa3d80c3ae8c2d7fcef5d63c2997b99059baf
Contents?: true
Size: 649 Bytes
Versions: 2
Compression:
Stored size: 649 Bytes
Contents
module Danica class Function include Common include VariablesHolder include ActiveModel::Model attr_accessor :name default_value :priority, 3 default_value :is_grouped?, false 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.1.0 | lib/danica/function.rb |
danica-2.0.6 | lib/danica/function.rb |