hesabu 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1890b75fe839c948d3209040eb520e852e11681babaf9b2261a8bc932cf42230
4
- data.tar.gz: 51c8bb8eb5ea57c69dbe4abc1549c51568cdca686f249648df1507394281a8c9
3
+ metadata.gz: abe943d484f4a7c14677bbd0edaa584a9705718b76dbf6584e827c61d804b290
4
+ data.tar.gz: feb5c1e48b9bd534e9e780b282e4dc0c246b77c6c9897b7d355acb23efa19967
5
5
  SHA512:
6
- metadata.gz: 5f6b9395785205e50a586e57ebe9de9814a01bad904699a750a1d5683831a28c49fe0f0691d0c1272cbfff5eb628bedef6bf7e2a7af76a9f5a6de314a7d10769
7
- data.tar.gz: da50d8020081d571c5ef11819068f9377ebd39b159c5e2b57d6b78b5934a8c4505434ff42730283d85b1adce818f325c479a8526ba8bc817b4a7ae4815c86d25
6
+ metadata.gz: d85f9343ef7f93028552e8ccf73be54c5eac7d4210a9172666f06b72bf941660e9bf21f528c5bc3a53236566963bb3b832b17456349f3959f5047e4d9831e5c1
7
+ data.tar.gz: 696f4a816991e4fcf72cf1291c3c392215d2d7f13f1ebc167db32ae80cfdfa8d27ad38a802eae91d58e416f063a7bd744e6f4dfa56fc5a83333b92cd1956fd0e
data/README.md CHANGED
@@ -1,3 +1,4 @@
1
+ [![Gem](https://img.shields.io/gem/v/hesabu.svg)](https://rubygems.org/gems/hesabu)
1
2
  [![Maintainability](https://api.codeclimate.com/v1/badges/f2643a76ea031525ed1f/maintainability)](https://codeclimate.com/github/BLSQ/hesabu/maintainability)
2
3
  [![Test Coverage](https://api.codeclimate.com/v1/badges/f2643a76ea031525ed1f/test_coverage)](https://codeclimate.com/github/BLSQ/hesabu/test_coverage)
3
4
  [![Build Status](https://travis-ci.org/BLSQ/hesabu.svg?branch=master)](https://travis-ci.org/BLSQ/hesabu)
@@ -7,6 +8,26 @@
7
8
  Hesabu : equation solver based on parslet.
8
9
 
9
10
 
11
+ ## deployment to rubygems.org
12
+
13
+ one time setup
14
+
15
+ ```
16
+ gem install gem-release
17
+ curl -u rubygemaccount https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials
18
+ chmod 0600 ~/.gem/credentials
19
+
20
+ ```
21
+
22
+
23
+ ```
24
+ gem bump
25
+ gem build hesabu.gemspec
26
+ gem push hesabu-x.x.x.gem
27
+
28
+ ```
29
+
30
+
10
31
  ## License
11
32
 
12
33
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -67,6 +67,22 @@ module Hesabu
67
67
  end
68
68
  end
69
69
 
70
+ class AbsFunction
71
+ def call(args)
72
+ raise "expected args #{self.class.name} : #{args}" if args.size != 1
73
+ args.first.eval.abs
74
+ end
75
+ end
76
+
77
+ class AccessFunction
78
+ def call(args)
79
+ values = args.map(&:eval)
80
+ array = values[0..-2]
81
+ index = values[-1]
82
+ array[index]
83
+ end
84
+ end
85
+
70
86
  FUNCTIONS = {
71
87
  "if" => IfFunction.new,
72
88
  "sum" => SumFunction.new,
@@ -75,7 +91,9 @@ module Hesabu
75
91
  "max" => MaxFunction.new,
76
92
  "safe_div" => SafeDivFunction.new,
77
93
  "randbetween" => RandbetweenFunction.new,
78
- "score_table" => ScoreTableFunction.new
94
+ "score_table" => ScoreTableFunction.new,
95
+ "abs" => AbsFunction.new,
96
+ "access" => AccessFunction.new,
79
97
  }.freeze
80
98
 
81
99
  FunCall = Struct.new(:name, :args) do
@@ -1,3 +1,3 @@
1
1
  module Hesabu
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hesabu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stéphan Mestach