-
-
Save proteste-dcm/c4f49f680d4fdf1450ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[2] pry(#<PublicationChannel>)> calculator | |
=> #<Dentaku::Calculator:0x007f2608aa7fa0 | |
@ast_cache={}, | |
@memory={"cost_of_eletricity"=>0.253, "scrn_native_vert"=>10.0, "connectstodlnaserver"=>100.0}, | |
@tokenizer= | |
#<Dentaku::Tokenizer:0x007f2608aa7ed8 | |
@nesting=0, | |
@tokens= | |
[#<Dentaku::Token:0x007f2605459c28 @category=:grouping, @raw_value="(", @value=:open>, | |
#<Dentaku::Token:0x007f2605458b20 @category=:grouping, @raw_value="(", @value=:open>, | |
#<Dentaku::Token:0x007f2605458350 @category=:numeric, @raw_value="1", @value=1>, | |
#<Dentaku::Token:0x007f2605206ac0 @category=:operator, @raw_value="+", @value=:add>, | |
#<Dentaku::Token:0x007f2606df3e18 @category=:identifier, @raw_value="scrn_native_vert", @value="scrn_native_vert">, | |
#<Dentaku::Token:0x007f2606df3698 @category=:grouping, @raw_value=")", @value=:close>, | |
#<Dentaku::Token:0x007f2606df2f68 @category=:operator, @raw_value="*", @value=:multiply>, | |
#<Dentaku::Token:0x007f2606df25e0 @category=:identifier, @raw_value="connectstodlnaserver", @value="connectstodlnaserver">, | |
#<Dentaku::Token:0x007f2606df1eb0 @category=:grouping, @raw_value=")", @value=:close>, | |
#<Dentaku::Token:0x007f2606df17d0 @category=:operator, @raw_value="/", @value=:divide>, | |
#<Dentaku::Token:0x007f2606df0ec0 @category=:identifier, @raw_value="cost_of_eletricity", @value="cost_of_eletricity">]>> | |
[3] pry(#<PublicationChannel>)> conditions[:formula].downcase | |
=> "( ( 1 + scrn_native_vert ) * connectstodlnaserver ) / cost_of_eletricity" | |
[4] pry(#<PublicationChannel>)> calculator.evaluate(conditions[:formula].downcase) | |
ArgumentError: can't omit precision for a Float. | |
from /home/vagrant/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/dentaku-2.0.3/lib/dentaku/ast/arithmetic.rb:55:in `initialize' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment