occi-core 4.3.1 → 4.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e96f1134c66ae55f82559690a791227f550e25b0
4
- data.tar.gz: 11c99606645e18a9ac247fbbe23df3ba603d1aba
3
+ metadata.gz: ab90d293ad87442dcc348913d4207b4ab7080355
4
+ data.tar.gz: baa4a75d3589c093497426c4f62fb73b1c3a13b2
5
5
  SHA512:
6
- metadata.gz: 3ffb32841f7855e60c9a01d05860d4d787294205a7dc473dd007494fdea846a7fd249e88f5fc62d494df84cf7ccdab0d40d024df1a9dcfa10b2e9a3fc4aa5af4
7
- data.tar.gz: 63829be1f49304bd94194824966eef60e9cb17992582297b54c1b840b2d08f1c2b6b21ce11e35bd675137291b25241c1b417e7bac11714bae552742aaf2b310b
6
+ metadata.gz: 44da88d724d42b4755e614388915154eeaa5ee454de1ae6ff0da007ca49f5c820a4f55fd26d11293aeea1458cdc49ccaa6bc061aef1c9662bf707bcc8d640d30
7
+ data.tar.gz: afc285a50e24b85ba41b40c8623563f17b31b3e1b1f0653ec35c933fe2511f030531e0080b72a38105fe14aa3f944379e0c7d696306bf200df56d535dd2bdc7f
@@ -115,21 +115,7 @@ module Occi
115
115
  title = match[:title]
116
116
  related = match[:rel].to_s.split(/\s+/)
117
117
 
118
- attributes = Occi::Core::Attributes.new
119
- if match[:attributes]
120
- match[:attributes].split.each do |attribute|
121
- property_string = attribute[/#{REGEXP_ATTRIBUTE_DEF}/, -2]
122
- properties = Occi::Core::Properties.new
123
-
124
- if property_string
125
- properties.required = property_string.include?('required')
126
- properties.mutable = !property_string.include?('immutable')
127
- end
128
-
129
- name = attribute[/#{REGEXP_ATTRIBUTE_DEF}/, 1]
130
- attributes.merge! name.split('.').reverse.inject(properties) { |a, n| Occi::Core::Attributes.new(n => a) }
131
- end
132
- end
118
+ attributes = category_attributes(match[:attributes])
133
119
  actions = match[:actions].to_s.split
134
120
  location = match[:location]
135
121
 
@@ -148,6 +134,30 @@ module Occi
148
134
  end
149
135
  end
150
136
 
137
+ def category_attributes(matched_attributes)
138
+ attributes = Occi::Core::Attributes.new
139
+ return attributes unless matched_attributes
140
+
141
+ # TODO: find a better approach to fixing split
142
+ matched_attributes.gsub! /\{(immutable|required)\s+(required|immutable)\}/, '{\1_\2}'
143
+
144
+ matched_attributes.split.each do |attribute|
145
+ attribute.gsub! /\{(immutable|required)_(required|immutable)\}/, '{\1 \2}'
146
+ property_string = attribute[/#{REGEXP_ATTRIBUTE_DEF}/, -2]
147
+ properties = Occi::Core::Properties.new
148
+
149
+ if property_string
150
+ properties.required = property_string.include?('required')
151
+ properties.mutable = !property_string.include?('immutable')
152
+ end
153
+
154
+ name = attribute[/#{REGEXP_ATTRIBUTE_DEF}/, 1]
155
+ attributes.merge! name.split('.').reverse.inject(properties) { |a, n| Occi::Core::Attributes.new(n => a) }
156
+ end
157
+
158
+ attributes
159
+ end
160
+
151
161
  def attribute(string)
152
162
  Occi::Log.debug "[#{self}] Parsing through Occi::Parser::Text.attribute"
153
163
  # create regular expression from regexp string
data/lib/occi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Occi
2
- VERSION = "4.3.1" unless defined?(::Occi::VERSION)
2
+ VERSION = "4.3.2" unless defined?(::Occi::VERSION)
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: occi-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.1
4
+ version: 4.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Feldhaus
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-10-06 00:00:00.000000000 Z
13
+ date: 2014-10-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json