occi-core 4.1.1 → 4.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/occi/parser/text.rb +3 -2
- data/lib/occi/version.rb +1 -1
- data/spec/occi/parser/text_spec.rb +9 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b884e7dad15d650f4b9d82c029a5581176c13fa
|
4
|
+
data.tar.gz: 6fcf4b0cd0141f1aaba9b5287fd6aa5206c165af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22fffb43cbf87277d3c18453687873a8e37a87c76cfcad265a76e44781a0a3acf1a71a3030b60e299b55ccc9f607f789d9d243defb3f799475666e4890acae77
|
7
|
+
data.tar.gz: 4e50e65a640d86a6ac8f8b0db7dce4418835493e37be5a452d3a63c473a6cbde2545fa7a43db874c37bc730b452c5ee5a866d40cc10e7d66ceacac60de45b3be
|
data/lib/occi/parser/text.rb
CHANGED
@@ -5,6 +5,7 @@ module Occi
|
|
5
5
|
# Regular expressions
|
6
6
|
REGEXP_QUOTED_STRING = /([^"\\]|\\.)*/
|
7
7
|
REGEXP_LOALPHA = /[a-z]/
|
8
|
+
REGEXP_ALPHA = /[a-zA-Z]/
|
8
9
|
REGEXP_DIGIT = /[0-9]/
|
9
10
|
REGEXP_INT = /#{REGEXP_DIGIT}+/
|
10
11
|
REGEXP_FLOAT = /#{REGEXP_INT}\.#{REGEXP_INT}/
|
@@ -14,7 +15,7 @@ module Occi
|
|
14
15
|
# Regular expressions for OCCI
|
15
16
|
if Occi::Settings.compatibility
|
16
17
|
# Compatibility with terms starting with a number
|
17
|
-
REGEXP_TERM = /(#{
|
18
|
+
REGEXP_TERM = /(#{REGEXP_ALPHA}|#{REGEXP_DIGIT})(#{REGEXP_ALPHA}|#{REGEXP_DIGIT}|-|_)*/
|
18
19
|
else
|
19
20
|
REGEXP_TERM = /#{REGEXP_LOALPHA}(#{REGEXP_LOALPHA}|#{REGEXP_DIGIT}|-|_)*/
|
20
21
|
end
|
@@ -154,7 +155,7 @@ module Occi
|
|
154
155
|
|
155
156
|
raise "could not match #{string}" unless match
|
156
157
|
|
157
|
-
term = match[:term]
|
158
|
+
term = match[:term].downcase
|
158
159
|
scheme = match[:scheme]
|
159
160
|
title = match[:title]
|
160
161
|
related = match[:rel].to_s.split
|
data/lib/occi/version.rb
CHANGED
@@ -34,6 +34,15 @@ module Occi
|
|
34
34
|
category.class.should eq Occi::Core::Kind
|
35
35
|
end
|
36
36
|
|
37
|
+
it 'parses a string describing an OCCI Category with uppercase term' do
|
38
|
+
category_string = 'Category: TERM;scheme="http://a.a/a#";class=kind'
|
39
|
+
|
40
|
+
category = Occi::Parser::Text.category category_string
|
41
|
+
category.term.should eq 'term'
|
42
|
+
category.scheme.should eq 'http://a.a/a#'
|
43
|
+
category.class.should eq Occi::Core::Kind
|
44
|
+
end
|
45
|
+
|
37
46
|
end
|
38
47
|
|
39
48
|
describe '.resource' do
|