naive_calculator 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +58 -0
- data/README.md +35 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/naive_calculator +6 -0
- data/lib/naive_calculator/arithmetic.treetop +218 -0
- data/lib/naive_calculator/calculator.rb +20 -0
- data/lib/naive_calculator/environment.rb +49 -0
- data/lib/naive_calculator/plot.rb +3 -0
- data/lib/naive_calculator/repl.rb +88 -0
- data/lib/naive_calculator/version.rb +3 -0
- data/lib/naive_calculator.rb +15 -0
- data/naive_calculator.gemspec +44 -0
- metadata +151 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 563543088d0288c2dbd5871d1e41f135d6f053c3
|
4
|
+
data.tar.gz: 3dfbb1623206a35b9e09987f16f289be9f91590a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ff59abeafdd263389280a5893b912937ba939084d37ad045d1d9a315d725eed7a370cb75dd6e52b6d70b3407a88f9f383181661c06c97b0d086c8e9fe9d1e056
|
7
|
+
data.tar.gz: b66bd86d9159873db4658f693ca80870afaf9458982472fb9ed7db8311f5dbd4177afdc3b829c65266376743524e3a1af136502c4d0434b8ad98e2f4d5884606
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
naive_calculator (0.1.0)
|
5
|
+
activesupport
|
6
|
+
pry
|
7
|
+
treetop
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
activesupport (5.2.3)
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
i18n (>= 0.7, < 2)
|
15
|
+
minitest (~> 5.1)
|
16
|
+
tzinfo (~> 1.1)
|
17
|
+
coderay (1.1.2)
|
18
|
+
concurrent-ruby (1.1.5)
|
19
|
+
diff-lcs (1.3)
|
20
|
+
i18n (1.6.0)
|
21
|
+
concurrent-ruby (~> 1.0)
|
22
|
+
method_source (0.9.2)
|
23
|
+
minitest (5.11.3)
|
24
|
+
polyglot (0.3.5)
|
25
|
+
pry (0.12.2)
|
26
|
+
coderay (~> 1.1.0)
|
27
|
+
method_source (~> 0.9.0)
|
28
|
+
rake (10.5.0)
|
29
|
+
rspec (3.8.0)
|
30
|
+
rspec-core (~> 3.8.0)
|
31
|
+
rspec-expectations (~> 3.8.0)
|
32
|
+
rspec-mocks (~> 3.8.0)
|
33
|
+
rspec-core (3.8.0)
|
34
|
+
rspec-support (~> 3.8.0)
|
35
|
+
rspec-expectations (3.8.3)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.8.0)
|
38
|
+
rspec-mocks (3.8.0)
|
39
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
+
rspec-support (~> 3.8.0)
|
41
|
+
rspec-support (3.8.0)
|
42
|
+
thread_safe (0.3.6)
|
43
|
+
treetop (1.6.10)
|
44
|
+
polyglot (~> 0.3)
|
45
|
+
tzinfo (1.2.5)
|
46
|
+
thread_safe (~> 0.1)
|
47
|
+
|
48
|
+
PLATFORMS
|
49
|
+
ruby
|
50
|
+
|
51
|
+
DEPENDENCIES
|
52
|
+
bundler (~> 2.0)
|
53
|
+
naive_calculator!
|
54
|
+
rake (~> 10.0)
|
55
|
+
rspec (~> 3.0)
|
56
|
+
|
57
|
+
BUNDLED WITH
|
58
|
+
2.0.1
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# NaiveCalculator
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/naive_calculator`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'naive_calculator'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install naive_calculator
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/naive_calculator.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "naive_calculator"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
grammar Arithmetic
|
2
|
+
rule body
|
3
|
+
command / fundef / assign / expression
|
4
|
+
end
|
5
|
+
|
6
|
+
rule expression
|
7
|
+
additive
|
8
|
+
end
|
9
|
+
|
10
|
+
rule additive
|
11
|
+
(head:multitive
|
12
|
+
tail:(
|
13
|
+
space operator:additive_op
|
14
|
+
space operand:multitive)*
|
15
|
+
) {
|
16
|
+
def eval(env)
|
17
|
+
tail.elements.inject(head.eval(env)) do |value, element|
|
18
|
+
element.operator.apply(value, element.operand.eval(env))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
rule additive_op
|
25
|
+
'+' {
|
26
|
+
def apply(a, b)
|
27
|
+
a + b
|
28
|
+
end
|
29
|
+
}
|
30
|
+
/
|
31
|
+
'-' {
|
32
|
+
def apply(a, b)
|
33
|
+
a - b
|
34
|
+
end
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
rule multitive
|
39
|
+
(head:exponential
|
40
|
+
tail:(
|
41
|
+
space operator:multitive_op
|
42
|
+
space operand:exponential)*
|
43
|
+
) {
|
44
|
+
def eval(env)
|
45
|
+
tail.elements.inject(head.eval(env)) do |value, element|
|
46
|
+
element.operator.apply(value, element.operand.eval(env))
|
47
|
+
end
|
48
|
+
end
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
rule multitive_op
|
53
|
+
'*' {
|
54
|
+
def apply(a, b)
|
55
|
+
a * b
|
56
|
+
end
|
57
|
+
}
|
58
|
+
/
|
59
|
+
'/' {
|
60
|
+
def apply(a, b)
|
61
|
+
a / b
|
62
|
+
end
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
rule exponential
|
67
|
+
(head:primary
|
68
|
+
tail:(
|
69
|
+
space operator:exp_op
|
70
|
+
space operand:primary)*
|
71
|
+
) {
|
72
|
+
def eval(env)
|
73
|
+
tail.elements.inject(head.eval(env)) do |value, element|
|
74
|
+
element.operator.apply(value, element.operand.eval(env))
|
75
|
+
end
|
76
|
+
end
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
rule exp_op
|
81
|
+
'^' {
|
82
|
+
def apply(a, b)
|
83
|
+
a**b
|
84
|
+
end
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
rule primary
|
89
|
+
(minus:'-'? primary_without_sign) {
|
90
|
+
def eval(env)
|
91
|
+
primary_without_sign.eval(env) * (minus.present? ? -1 : 1)
|
92
|
+
end
|
93
|
+
}
|
94
|
+
end
|
95
|
+
|
96
|
+
rule primary_without_sign
|
97
|
+
funcall /
|
98
|
+
variable /
|
99
|
+
number /
|
100
|
+
'(' space expression space ')' {
|
101
|
+
def eval(env)
|
102
|
+
expression.eval(env)
|
103
|
+
end
|
104
|
+
}
|
105
|
+
end
|
106
|
+
|
107
|
+
rule assign
|
108
|
+
(variable space '=' space expression) {
|
109
|
+
def eval(env)
|
110
|
+
env.define_variable variable.text_value.to_sym, expression.eval(env)
|
111
|
+
end
|
112
|
+
}
|
113
|
+
end
|
114
|
+
|
115
|
+
rule variable
|
116
|
+
[a-z]+ {
|
117
|
+
def eval(env)
|
118
|
+
env.lookup_variable text_value.to_sym
|
119
|
+
end
|
120
|
+
}
|
121
|
+
end
|
122
|
+
|
123
|
+
rule fundef
|
124
|
+
(fun:[a-z]+ '(' arglist:(arg:[a-z]+ (space ',' space arg:[a-z]+)*) ')' space '=' space expression) {
|
125
|
+
def eval(env)
|
126
|
+
args = [arglist.arg.text_value] + arglist.elements.last.elements.map { |e| e.arg.text_value }
|
127
|
+
|
128
|
+
env.define_function(
|
129
|
+
fun.text_value.to_sym,
|
130
|
+
args.size,
|
131
|
+
lambda do |*a|
|
132
|
+
ne = env.clone
|
133
|
+
|
134
|
+
args.each_with_index do |arg, index|
|
135
|
+
ne.define_variable(arg.to_sym, a[index])
|
136
|
+
end
|
137
|
+
|
138
|
+
expression.eval(ne)
|
139
|
+
end
|
140
|
+
)
|
141
|
+
end
|
142
|
+
}
|
143
|
+
end
|
144
|
+
|
145
|
+
rule funcall
|
146
|
+
(fun:variable '(' arglist:(expression (space ',' space expression)*) ')') {
|
147
|
+
def eval(env)
|
148
|
+
args = [arglist.expression.eval(env)] + arglist.elements.last.elements.map { |e| e.expression.eval(env) }
|
149
|
+
|
150
|
+
f = env.lookup_function(fun.text_value.to_sym, args.size)
|
151
|
+
|
152
|
+
f.call(*args)
|
153
|
+
end
|
154
|
+
}
|
155
|
+
end
|
156
|
+
|
157
|
+
rule unary_minus
|
158
|
+
('-' expression) {
|
159
|
+
def eval(env)
|
160
|
+
-expression.eval(env)
|
161
|
+
end
|
162
|
+
}
|
163
|
+
end
|
164
|
+
|
165
|
+
rule number
|
166
|
+
float / integer
|
167
|
+
end
|
168
|
+
|
169
|
+
rule float
|
170
|
+
(digits '.' digits) {
|
171
|
+
def eval(env)
|
172
|
+
BigDecimal.new(text_value)
|
173
|
+
end
|
174
|
+
}
|
175
|
+
end
|
176
|
+
|
177
|
+
rule integer
|
178
|
+
([1-9] [0-9]* / '0') {
|
179
|
+
def eval(env)
|
180
|
+
BigDecimal.new(text_value.to_i)
|
181
|
+
end
|
182
|
+
}
|
183
|
+
end
|
184
|
+
|
185
|
+
rule digits
|
186
|
+
[0-9]+
|
187
|
+
end
|
188
|
+
|
189
|
+
rule space
|
190
|
+
' '*
|
191
|
+
end
|
192
|
+
|
193
|
+
# rule sign
|
194
|
+
# '-'?
|
195
|
+
# end
|
196
|
+
|
197
|
+
rule command
|
198
|
+
plot
|
199
|
+
end
|
200
|
+
|
201
|
+
rule plot
|
202
|
+
('plot' space expression space ',' space variable space 'from' space min:expression space 'to' space max:expression) {
|
203
|
+
def eval(env)
|
204
|
+
callable = lambda do |var|
|
205
|
+
ne = env.clone
|
206
|
+
ne.define_variable(variable.text_value.to_sym, var)
|
207
|
+
expression.eval(ne)
|
208
|
+
end
|
209
|
+
|
210
|
+
NaiveCalculator::Plot.new(
|
211
|
+
callable,
|
212
|
+
min.eval(env),
|
213
|
+
max.eval(env)
|
214
|
+
)
|
215
|
+
end
|
216
|
+
}
|
217
|
+
end
|
218
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Treetop.load 'lib/naive_calculator/arithmetic'
|
2
|
+
|
3
|
+
module NaiveCalculator
|
4
|
+
class Calculator
|
5
|
+
def initialize
|
6
|
+
@environment = Environment.new
|
7
|
+
@parser = ArithmeticParser.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def evaluate(input)
|
11
|
+
parse_tree = @parser.parse(input)
|
12
|
+
|
13
|
+
if parse_tree
|
14
|
+
parse_tree.eval(@environment)
|
15
|
+
else
|
16
|
+
raise 'Invalid input'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module NaiveCalculator
|
2
|
+
class Environment
|
3
|
+
Function = Struct.new(:arity, :body) do
|
4
|
+
def to_s
|
5
|
+
"function/#{arity}"
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(initial_bindings: {})
|
10
|
+
@bindings = initial_bindings.merge(
|
11
|
+
pi: BigDecimal(Math::PI, 15),
|
12
|
+
e: BigDecimal(Math::E, 15)
|
13
|
+
)
|
14
|
+
|
15
|
+
@functions = {
|
16
|
+
sin: Function.new(1, lambda { |x| BigDecimal(Math.sin(x), 10) }),
|
17
|
+
cos: Function.new(1, lambda { |x| BigDecimal(Math.cos(x), 10) }),
|
18
|
+
log: Function.new(2, lambda { |x,y| BigDecimal(Math.log(x, y), 10) }),
|
19
|
+
pow: Function.new(2, lambda { |x,y| x**y }),
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize_copy(*)
|
24
|
+
@bindings = @bindings.dup
|
25
|
+
@functions = @functions.dup
|
26
|
+
end
|
27
|
+
|
28
|
+
def lookup_variable(name)
|
29
|
+
@bindings[name] or raise "No variable `#{name}`"
|
30
|
+
end
|
31
|
+
|
32
|
+
def define_variable(name, value)
|
33
|
+
@bindings[name] = value
|
34
|
+
end
|
35
|
+
|
36
|
+
def define_function(name, arity, body)
|
37
|
+
@functions[name] = Function.new(arity, body)
|
38
|
+
end
|
39
|
+
|
40
|
+
def lookup_function(name, arity)
|
41
|
+
function = @functions[name]
|
42
|
+
|
43
|
+
raise "No function `#{name}`" unless function
|
44
|
+
raise "Function `#{name}` takes #{function.arity} argument(s) (#{arity} given)" unless function.arity == arity
|
45
|
+
|
46
|
+
function.body
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module NaiveCalculator
|
2
|
+
module Repl
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def run
|
6
|
+
init
|
7
|
+
|
8
|
+
calculator = Calculator.new
|
9
|
+
|
10
|
+
while input = Readline.readline("> ", true) do
|
11
|
+
begin
|
12
|
+
result = calculator.evaluate(input)
|
13
|
+
pretty_print(result)
|
14
|
+
rescue RuntimeError => e
|
15
|
+
puts e.message
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def init
|
21
|
+
at_exit do
|
22
|
+
puts "\nBye!"
|
23
|
+
end
|
24
|
+
|
25
|
+
Signal.trap(:INT) do
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def pretty(s)
|
30
|
+
case s
|
31
|
+
when BigDecimal
|
32
|
+
'=> ' + s.to_s('F').chomp('.0')
|
33
|
+
when Numeric
|
34
|
+
'=> ' + s.to_s
|
35
|
+
when Plot
|
36
|
+
plot(s)
|
37
|
+
else
|
38
|
+
s.to_s
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def pretty_print(s)
|
43
|
+
puts pretty(s)
|
44
|
+
end
|
45
|
+
|
46
|
+
def plot(plot_data)
|
47
|
+
x_range = 90
|
48
|
+
y_range = 10
|
49
|
+
|
50
|
+
result = (y_range + 1).times.map { ' ' * (x_range + 1) }
|
51
|
+
|
52
|
+
samples = x_range.times.map do |x|
|
53
|
+
rx = (x.to_f / x_range) * (plot_data.max_x - plot_data.min_x) + plot_data.min_x
|
54
|
+
ry = plot_data.function.call(rx)
|
55
|
+
|
56
|
+
[x, rx, ry]
|
57
|
+
end
|
58
|
+
|
59
|
+
min_y, max_y = [
|
60
|
+
samples.min_by { |x, rx, ry| ry }.last.to_f,
|
61
|
+
samples.max_by { |x, rx, ry| ry }.last.to_f,
|
62
|
+
]
|
63
|
+
|
64
|
+
range = max_y - min_y
|
65
|
+
|
66
|
+
samples.each do |x, rx, ry|
|
67
|
+
scaled_y = ((ry - min_y) / range * y_range).round
|
68
|
+
result[y_range - scaled_y][x] = 'O'
|
69
|
+
end
|
70
|
+
|
71
|
+
scaled_y_zero = (-min_y / range * y_range).round
|
72
|
+
if (0...y_range).include? scaled_y_zero
|
73
|
+
(x_range + 1).times do |x|
|
74
|
+
result[y_range - scaled_y_zero][x] = '.' unless result[y_range - scaled_y_zero][x] == 'O'
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
scaled_x_zero = (-plot_data.min_x.to_f / (plot_data.max_x - plot_data.min_x) * x_range).round
|
79
|
+
if (0...x_range).include? scaled_x_zero
|
80
|
+
(y_range + 1).times do |y|
|
81
|
+
result[y_range - y][scaled_x_zero] = '.' unless result[y_range - y][scaled_x_zero] == 'O'
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
result.join("\n")
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'bigdecimal'
|
2
|
+
require 'active_support'
|
3
|
+
require 'active_support/core_ext'
|
4
|
+
require 'readline'
|
5
|
+
require 'treetop'
|
6
|
+
|
7
|
+
require "naive_calculator/version"
|
8
|
+
require 'naive_calculator/repl'
|
9
|
+
require 'naive_calculator/plot'
|
10
|
+
require 'naive_calculator/environment'
|
11
|
+
require 'naive_calculator/calculator'
|
12
|
+
|
13
|
+
module NaiveCalculator
|
14
|
+
class Error < StandardError; end
|
15
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "naive_calculator/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "naive_calculator"
|
7
|
+
spec.version = NaiveCalculator::VERSION
|
8
|
+
spec.authors = ["Svetlin Simonyan"]
|
9
|
+
spec.email = ["svetlin.s@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{Calculator}
|
12
|
+
spec.description = %q{A calculator supporting mathematical expressions, variables, functions and rudimentary plotting}
|
13
|
+
spec.homepage = "https://github.com/svetlins/naive_calculator"
|
14
|
+
|
15
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
16
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
spec.metadata["allowed_push_host"] = 'https://rubygems.org'
|
19
|
+
|
20
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
21
|
+
spec.metadata["source_code_uri"] = "https://github.com/svetlins/naive_calculator"
|
22
|
+
spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
23
|
+
else
|
24
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
25
|
+
"public gem pushes."
|
26
|
+
end
|
27
|
+
|
28
|
+
# Specify which files should be added to the gem when it is released.
|
29
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
30
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
31
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
32
|
+
end
|
33
|
+
spec.bindir = "exe"
|
34
|
+
spec.executables = 'naive_calculator'
|
35
|
+
spec.require_paths = ["lib"]
|
36
|
+
|
37
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
38
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
39
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
40
|
+
|
41
|
+
spec.add_runtime_dependency 'treetop'
|
42
|
+
spec.add_runtime_dependency 'pry'
|
43
|
+
spec.add_runtime_dependency 'activesupport'
|
44
|
+
end
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: naive_calculator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Svetlin Simonyan
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-04-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: treetop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: activesupport
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: A calculator supporting mathematical expressions, variables, functions
|
98
|
+
and rudimentary plotting
|
99
|
+
email:
|
100
|
+
- svetlin.s@gmail.com
|
101
|
+
executables:
|
102
|
+
- naive_calculator
|
103
|
+
extensions: []
|
104
|
+
extra_rdoc_files: []
|
105
|
+
files:
|
106
|
+
- ".gitignore"
|
107
|
+
- ".rspec"
|
108
|
+
- ".travis.yml"
|
109
|
+
- Gemfile
|
110
|
+
- Gemfile.lock
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- bin/console
|
114
|
+
- bin/setup
|
115
|
+
- exe/naive_calculator
|
116
|
+
- lib/naive_calculator.rb
|
117
|
+
- lib/naive_calculator/arithmetic.treetop
|
118
|
+
- lib/naive_calculator/calculator.rb
|
119
|
+
- lib/naive_calculator/environment.rb
|
120
|
+
- lib/naive_calculator/plot.rb
|
121
|
+
- lib/naive_calculator/repl.rb
|
122
|
+
- lib/naive_calculator/version.rb
|
123
|
+
- naive_calculator.gemspec
|
124
|
+
homepage: https://github.com/svetlins/naive_calculator
|
125
|
+
licenses: []
|
126
|
+
metadata:
|
127
|
+
allowed_push_host: https://rubygems.org
|
128
|
+
homepage_uri: https://github.com/svetlins/naive_calculator
|
129
|
+
source_code_uri: https://github.com/svetlins/naive_calculator
|
130
|
+
changelog_uri: 'TODO: Put your gem''s CHANGELOG.md URL here.'
|
131
|
+
post_install_message:
|
132
|
+
rdoc_options: []
|
133
|
+
require_paths:
|
134
|
+
- lib
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
requirements: []
|
146
|
+
rubyforge_project:
|
147
|
+
rubygems_version: 2.5.2
|
148
|
+
signing_key:
|
149
|
+
specification_version: 4
|
150
|
+
summary: Calculator
|
151
|
+
test_files: []
|