parliament-ruby 0.4.0 → 0.4.1

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: 28594af037be384f693b54a2b86319171df55870
4
- data.tar.gz: 93304a061e7860dd550aaf5f3964d016419c93b2
3
+ metadata.gz: 35b478eb95f94d239b43577926d991cd8d7e185d
4
+ data.tar.gz: 80e3214e334fb5568e2474b76c6ccf4f510b469b
5
5
  SHA512:
6
- metadata.gz: df3e037738c1cff50f009e480c49a9c3e556d3c7ce465ec05cf93742d383d5eedd7deea1260a2abad6928c607a0557d0f4c8fe77617fe82f59ff62ddf758d5d6
7
- data.tar.gz: 5bcb5bf0637bc0b2577573ecc324b7565aa2df6f06e5819888915ac73b35df00b3dc06cdf1b9d9cd561d77b1e6f8152251272c638927add0658684a28a4cc7d8
6
+ metadata.gz: caa6aae8ea8c2a3c27fbecd534225010e7c4068651d972502bca85391d02623899a3f5f617671be79c1923f5a81259fd7d1e01043ad66c6fabe97b78811b807c
7
+ data.tar.gz: 9705db9a2c52ae0ae87e9fbe23693da6b1a1323b1766618f26f7e23dbfc7e39257ae3b32f73f4c9836f93bcad7ff33dff221956457ba4274dc9ce8cb8200b42c
@@ -6,11 +6,11 @@ module Parliament
6
6
  end
7
7
 
8
8
  def start_date
9
- respond_to?(:constituencyGroupStartDate) ? constituencyGroupStartDate : ''
9
+ respond_to?(:constituencyGroupStartDate) ? DateTime.parse(constituencyGroupStartDate) : nil
10
10
  end
11
11
 
12
12
  def end_date
13
- respond_to?(:constituencyGroupEndDate) ? constituencyGroupEndDate : ''
13
+ respond_to?(:constituencyGroupEndDate) ? DateTime.parse(constituencyGroupEndDate) : nil
14
14
  end
15
15
 
16
16
  def seats
@@ -58,8 +58,12 @@ module Parliament
58
58
  end
59
59
 
60
60
  def assign_decorator(object)
61
+ return object unless object.respond_to?(:type)
62
+
61
63
  object_type = Grom::Helper.get_id(object.type)
64
+
62
65
  return object unless Parliament::Decorators.constants.include?(object_type.to_sym)
66
+
63
67
  decorator_module = Object.const_get("Parliament::Decorators::#{object_type}")
64
68
  object.extend(decorator_module)
65
69
  end
@@ -38,7 +38,7 @@ module Parliament
38
38
  def sort_by(*parameters)
39
39
  rejected = []
40
40
  grom_nodes = @nodes.dup
41
- grom_nodes.delete_if { |node| rejected << node unless parameters.all?{ |param| node.respond_to?(param) } }
41
+ grom_nodes.delete_if { |node| rejected << node unless parameters.all? { |param| node.respond_to?(param) } }
42
42
  grom_nodes.sort_by! do |node|
43
43
  parameters.map { |param| node.send(param) }
44
44
  end
@@ -1,3 +1,3 @@
1
1
  module Parliament
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '0.4.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parliament-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Rayner
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-24 00:00:00.000000000 Z
11
+ date: 2017-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grom