moonrope 1.2.0 → 1.2.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: aaca3dee3108ec017c94921848e0cf7bf5de4136
4
- data.tar.gz: 703c784363fe0cc329931c7568c5603b1b863bef
3
+ metadata.gz: daba7a2efd635f91a04eb69d14fcea60738c8be6
4
+ data.tar.gz: 79bfec85cd725a038f2922c38e69fedb4e3a1a85
5
5
  SHA512:
6
- metadata.gz: e28959e2e988a35fbb030b944dafeb086b0c973f9691cc23c2c0d23cf63fb2b3cc03b776af60c7e6022241b749ee6fb85b6f9d78fedc03c90c61bba2f4e9df53
7
- data.tar.gz: e5917f0184a0113189a5291b6a91240c987dd52d9725728d57ab69e9cffaedd2f7148ce01b67a79f326c714859f3c9c1d8e2112301a6641ae1a43b46a6abefb8
6
+ metadata.gz: 1d3ce17c2a410105909bd97ebbac3b8ee2e362c5945805772f02fe9f5038a42241d19cb5a2f9c9cabb71c753ee3a385becdd102e7ef10d13d51899702c515531
7
+ data.tar.gz: e44eb7bc43ea321a06f10549dd9e4551fd5d43a3a24e928590b669e63e3ba1b805b60f9b9734707d4635c7f0cfab6f9f6436b335a9edad6eeb1e5c2b099bb50b
@@ -49,7 +49,8 @@ module Moonrope
49
49
  attribute.structure = options[:structure]
50
50
  attribute.structure_opts = options[:structure_opts]
51
51
  attribute.value_type = options[:type]
52
- attribute.source_attribute = options[:source] || options[:name]
52
+ attribute.source_attribute = options[:source_attribute]
53
+ attribute.value = options[:value]
53
54
  attribute.groups = @groups
54
55
  attribute.conditions = @conditions
55
56
  @structure.attributes[type] << attribute
@@ -39,8 +39,6 @@ module Moonrope
39
39
  end
40
40
  end
41
41
 
42
- puts app.config.moonrope.helpers.inspect
43
-
44
42
  # Insert the Moonrope middleware into the application's middleware
45
43
  # stack (at the bottom).
46
44
  app.middleware.use(
@@ -116,7 +116,13 @@ module Moonrope
116
116
  end
117
117
  end
118
118
 
119
- value = value_for_attribute(object, environment, attribute)
119
+ if attribute.value.is_a?(Proc)
120
+ value = environment.instance_eval(&attribute.value)
121
+ elsif attribute.value
122
+ value = attribute.value
123
+ else
124
+ value = value_for_attribute(object, environment, attribute)
125
+ end
120
126
 
121
127
  if attribute.groups.empty?
122
128
  hash[attribute.name] = value
@@ -9,6 +9,7 @@ module Moonrope
9
9
  attr_accessor :value_type
10
10
  attr_accessor :structure
11
11
  attr_accessor :structure_opts
12
+ attr_accessor :value
12
13
 
13
14
  def initialize(type, name, description)
14
15
  @type = type
@@ -1,3 +1,3 @@
1
1
  module Moonrope
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moonrope
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke