code-ruby 0.9.1 → 0.9.2

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
  SHA256:
3
- metadata.gz: 1f92c4c4db84ee34d5e5d58325ab4de49d9346a738239aba44682db9e2530e7e
4
- data.tar.gz: 6d056953ec6852d7824343f45198e0b35f13db881420fdce645753e091249ac7
3
+ metadata.gz: 2a15136e1a9999fb8cba9a433f0e72d6bd237b8de8d0c948477824944853da2d
4
+ data.tar.gz: 98a7b20d9225d717865eaa8fa461fa660e970a281f9de464725fd3923c0dee9f
5
5
  SHA512:
6
- metadata.gz: 98ddcc59fe93cf2625cbc521a08b2119bcb8fc1bd8cd6fd3da6fb40039a73aa8835e35234c3e77842fbbcc6fa57fe51377e96f457bfd6e391a5bd96d37229296
7
- data.tar.gz: 7b2723a4c912be64c3c7588fb905b40c6cd8fc510a61ca56a7af21037bd8d27d29a667659ea07a97d096d9a44d01dc6a5064f7a45ee58e39770d016a479353af
6
+ metadata.gz: 998e06a88b8d4bfb4cd1529c01a5ea347b3f1874c5c11ddbe9952942db999cb25bba645c5f49bfdb40ff7f17a217af035561ad58fcb06dd8c4383d8906362947
7
+ data.tar.gz: b9a5b0703efca344bdd1f1f0b972ddabad86746cbd6745eb71c2a82ef61fc4a30370bd7052dfe703e1a44055926f17c9a57005ff5b353057dc462078c148ea80
@@ -6,7 +6,11 @@ class Code
6
6
  attr_reader :raw
7
7
 
8
8
  def initialize(raw)
9
- @raw = raw
9
+ if raw.is_a?(Object)
10
+ @raw = raw.truthy?
11
+ else
12
+ @raw = !!raw
13
+ end
10
14
  end
11
15
 
12
16
  def self.name
@@ -6,6 +6,7 @@ class Code
6
6
  attr_reader :raw
7
7
 
8
8
  def initialize(raw)
9
+ raw = raw.raw if raw.is_a?(Class)
9
10
  @raw = raw
10
11
  end
11
12
 
@@ -6,7 +6,8 @@ class Code
6
6
  attr_reader :parent
7
7
 
8
8
  def initialize(raw = {}, parent: nil)
9
- @raw = raw
9
+ raw = raw.raw if raw.is_a?(Dictionary)
10
+ @raw = raw.to_h
10
11
  @parent = parent
11
12
  end
12
13
 
@@ -6,7 +6,8 @@ class Code
6
6
  attr_reader :raw
7
7
 
8
8
  def initialize(date)
9
- @raw = date
9
+ date = date.raw if date.is_a?(Date)
10
+ @raw = date.to_date
10
11
  end
11
12
 
12
13
  def self.name
@@ -6,6 +6,7 @@ class Code
6
6
  attr_reader :raw
7
7
 
8
8
  def initialize(decimal, exponent: nil)
9
+ decimal = decimal.raw if decimal.is_a?(Decimal)
9
10
  @raw = BigDecimal(decimal)
10
11
 
11
12
  return unless exponent
@@ -6,7 +6,8 @@ class Code
6
6
  attr_reader :raw
7
7
 
8
8
  def initialize(raw = {})
9
- @raw = raw
9
+ raw = raw.raw if raw.is_a?(Dictionary)
10
+ @raw = raw.to_h
10
11
  end
11
12
 
12
13
  def self.name
@@ -6,6 +6,7 @@ class Code
6
6
  attr_reader :raw
7
7
 
8
8
  def initialize(duration)
9
+ duration = duration.raw if duration.is_a?(Duration)
9
10
  @raw = duration
10
11
  end
11
12
 
@@ -6,6 +6,7 @@ class Code
6
6
  attr_reader :raw
7
7
 
8
8
  def initialize(raw = [])
9
+ raw = raw.raw if raw.is_a?(List)
9
10
  @raw = raw.to_a
10
11
  end
11
12
 
@@ -8,7 +8,7 @@ class Code
8
8
  def initialize(left, right, exclude_end: false)
9
9
  @left = left
10
10
  @right = right
11
- @exclude_end = exclude_end
11
+ @exclude_end = !!exclude_end
12
12
  @raw = ::Range.new(left, right, exclude_end)
13
13
  end
14
14
 
@@ -6,6 +6,7 @@ class Code
6
6
  attr_reader :raw
7
7
 
8
8
  def initialize(string)
9
+ string = string.raw if string.is_a?(String)
9
10
  @raw = string.to_s
10
11
  end
11
12
 
data/lib/code/version.rb CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  require_relative "../code"
4
4
 
5
- Code::Version = Gem::Version.new("0.9.1")
5
+ Code::Version = Gem::Version.new("0.9.2")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié