Sha256: bf9623d145789d2b1925c2d3ea8300793571e5f132e312a5fec89072d91b4849

Contents?: true

Size: 603 Bytes

Versions: 1

Compression:

Stored size: 603 Bytes

Contents

class Danica::Function
  include ActiveModel::Model

  require 'danica/function/chained'
  require 'danica/function/product'
  require 'danica/function/sum'
  require 'danica/function/division'

  attr_accessor :name, :variables

  def to_f
    raise 'Not IMplemented yet'
  end

  def to_tex
    raise 'Not IMplemented yet'
  end

  def variables=(variables)
    @variables = variables.map { |v| wrap_value(v) }
  end

  def valued?
    to_f.presend?
  rescue Danica::NotDefined
    false
  end

  private

  def wrap_value(value)
    value.is_a?(Numeric) ? Danica::Number.new(value) : value
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
danica-0.1.0 lib/danica/function.rb