tbmx 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tbmx.rb +14 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6034215d274609912b393d57dc418fde9f806b06
4
- data.tar.gz: 4656f36faee847e0e62179142e7b6ae31996564e
3
+ metadata.gz: 2ccb9cbb7c49767890fcf8779fba34b5c474ee1e
4
+ data.tar.gz: 1e9afa2a780a42f198721915935fb96eeeb20659
5
5
  SHA512:
6
- metadata.gz: 831a26ca020431a8552805e750ec31a91a69223e803094f94a3fdea8d86712b0900ee6b0810342f1ce23cc4486dad82816141d7ff7ffe02e4c701161e634c0d9
7
- data.tar.gz: d6907cae52a867208dc4b97ca0df957377491022fcd4756b771302ad7ae74b4410b17ded423efd77e3e239e94542b2869db367ad711138e2f877df8a7ce318cf
6
+ metadata.gz: db5e4c90cdb5cd751d69f686dfa0b8b706c7d84124daebe3cd7412ea44f94806e1cbba12017567ed284731c07ca9b3c578345460b7b858a6787a70222733fae5
7
+ data.tar.gz: 04534bafc9f28aeb7fadc7892872ee4a58afa41c85597bf0f9b5dcc24453c6eb56e0d8150ecae564bdca000ec4b0e88ea79da10c5f1772290aca9a38cd3dc41f
data/lib/tbmx.rb CHANGED
@@ -43,6 +43,18 @@ include ERB::Util
43
43
  module TBMX
44
44
  TB_COM = "http://thinkingbicycle.com"
45
45
 
46
+ module MathFunctions
47
+ class << self
48
+ def degrees2radians degrees
49
+ degrees * Math::PI / 180.0
50
+ end
51
+
52
+ def radians2degrees radians
53
+ radians * 180.0 / Math::PI
54
+ end
55
+ end
56
+ end
57
+
46
58
  class ParseError < RuntimeError
47
59
  end
48
60
 
@@ -325,13 +337,9 @@ module TBMX
325
337
  "sqrt"
326
338
  math_function_handler command.word.to_sym
327
339
  when "d2r", "deg->rad", "degrees->radians"
328
- degrees = number_from_expression
329
- radians = degrees * Math::PI / 180.0
330
- radians
340
+ MathFunctions::degrees2radians number_from_expression
331
341
  when "r2d", "rad->deg", "radians->degrees"
332
- radians = number_from_expression
333
- degrees = radians * 180.0 / Math::PI
334
- degrees
342
+ MathFunctions::radians2degrees number_from_expression
335
343
  when "log"
336
344
  base, number = numbers_from_expressions
337
345
  if number.nil?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tbmx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Mark Gore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-17 00:00:00.000000000 Z
11
+ date: 2015-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport