sqlite_ext 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1806296fef46316305e648f51c31a3934d511be8
4
- data.tar.gz: 4ae4555629a1e049acf0c702d9181d0f56b266e4
3
+ metadata.gz: e99ee0f6c66c7e55e973b02d7a9622f79b58da81
4
+ data.tar.gz: faede6051495e25fa791dcd9f8b9d121d52289d3
5
5
  SHA512:
6
- metadata.gz: 3f68fee690742d66fd5b164ff0e0aa57cc1da3a10de38b4e963f59c9fae1e3d357ad776fd8e090ca09a8ca22e27760b845ab3a135efb0b474acc3f45b5714ba4
7
- data.tar.gz: 3aa7004a593da3578ab7218658b06feea7f30faf62a023d4e2dcd424d01b4c0cf8390ad57171ce9c30af509571968a2c6f6ef88b16b2f861531db92a96d5b79b
6
+ metadata.gz: 61b01e63fa525cc1dde7f9734299fb7bd7b358620a3a2e32dadebf779a7cdb2ba66c255b0a7da2ed173a4547035ecc80fb5727ccb485046820fb5922fc858e73
7
+ data.tar.gz: f31a9220f5f51d89d6888c142d37ba37ebbed08c118f76ef5081fbd30eedc0a4f253b3864086d3db8cd22414445cdb77b2d3c0678c92682f621c34c3d5364df2
data/CHANGELOG.md CHANGED
@@ -1,4 +1,9 @@
1
- ### 1.3.0 - 2016-05-25
1
+ ### 1.4.0 - 2016-05-26
2
+ * Enhancements
3
+ * `SqliteExt.register_ruby_math` now also registers `pi`, `e`, `mod`,
4
+ and `power` functions.
5
+
6
+ ### 1.3.0 - 2016-05-26
2
7
  * Features
3
8
  * Adds `SQLite3::Database.function_created?` to check whether a
4
9
  function with a given name has been created on the target instance.
@@ -1,3 +1,3 @@
1
1
  module SqliteExt
2
- VERSION = '1.3.0'
2
+ VERSION = '1.4.0'
3
3
  end
data/lib/sqlite_ext.rb CHANGED
@@ -70,8 +70,9 @@ module SqliteExt
70
70
  end
71
71
 
72
72
  # Registers most of the public module methods of Ruby's
73
- # `Math` module as well as `ceil` and `floor` to be used as
74
- # functions in SQL code executed # through subsequent new
73
+ # `Math` module as well as `ceil`, `floor`, `mod`, and
74
+ # `power` based on `Float` instance methods to be used as
75
+ # functions in SQL code executed through subsequent new
75
76
  # instances of `SQLite3::Database`.
76
77
  #
77
78
  # The `Math.frexp` method is omitted becuse it returns an
@@ -101,8 +102,16 @@ module SqliteExt
101
102
  fn_methods.each do |m|
102
103
  register_function m, Math.method(m)
103
104
  end
104
- [:floor, :ceil].each do |m|
105
- register_function m, m.to_proc
105
+ register_function 'pi', ->(){ Math::PI }
106
+ register_function 'e', ->(){ Math::E }
107
+ [
108
+ [ :floor ],
109
+ [ :ceil ],
110
+ [ :modulo, :mod ],
111
+ [ :**, :power ]
112
+ ].each do |(*args)|
113
+ m, fn = args.first, args.last
114
+ register_function fn, m.to_proc
106
115
  end
107
116
  self.ruby_math_is_registered = true
108
117
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlite_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Jorgensen