raconteur 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/raconteur/parse.rb +6 -2
- data/lib/raconteur/processor.rb +2 -2
- data/lib/raconteur/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dae7db6a3938bee8091bbcabbda6ae5b26a2b54a
|
4
|
+
data.tar.gz: ab673e373254607228acb6081c1e35122832353a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f01c359a91e2ae8f1730faa05454119685c036b17579737118cfa27ee93ba2ff2fb8dcdde1b5ee0df7c7d06dccb48e8b1e79461158a99d5a5267c5af7a1d0f08
|
7
|
+
data.tar.gz: e763e2b21b5f5d1522cca03e9e8c7da014bbc10201d0eee65df7f2b7dd8d000b1ae77214791ee7f4db5ee216930e4e2cebfa962a54143c44c4299ad1195f7d52
|
data/lib/raconteur/parse.rb
CHANGED
@@ -73,6 +73,12 @@ class Raconteur::Parse
|
|
73
73
|
# input: (string) 'id=353 + report-title="E-Commerce Checkout Usability Report"'
|
74
74
|
# output: (hash) { id: '353', report_title: 'E-Commerce Checkout Usability Report' }
|
75
75
|
def self.parse_settings(str)
|
76
|
+
# prepare a fresh hash for the parsed settings
|
77
|
+
parsed_settings = {}
|
78
|
+
# return empty hash if settings string is 'nil'
|
79
|
+
if str == nil
|
80
|
+
return parsed_settings
|
81
|
+
end
|
76
82
|
# regex escape 'quote' character
|
77
83
|
quote = Regexp.quote(@@raconteur.settings.setting_quotes)
|
78
84
|
# Parsing logic:
|
@@ -83,8 +89,6 @@ class Raconteur::Parse
|
|
83
89
|
# b) a string wrapped by the 'quote' character at both ends
|
84
90
|
# (instances of the 'quote' character within the string can be escaped by a backward-slash '\')
|
85
91
|
regex = /([^\s#{quote}]+)\=(#{quote}.*?[^\\]#{quote}|[^\s]+)/mi
|
86
|
-
# prepare a fresh hash for the parsed settings
|
87
|
-
parsed_settings = {}
|
88
92
|
# loop over all key-value setting pairs in the string
|
89
93
|
str.scan(regex).each do |setting_str|
|
90
94
|
# grap keys and turn them into underscored symbols
|
data/lib/raconteur/processor.rb
CHANGED
@@ -95,9 +95,9 @@ class Raconteur::Processor
|
|
95
95
|
|
96
96
|
# regex for matching tag and its settings
|
97
97
|
def regex
|
98
|
-
/^\s*#{Regexp.quote(@processor.tag)}
|
98
|
+
/^\s*#{Regexp.quote(@processor.tag)}(:(?<settings>.*?))?\s*$/im
|
99
99
|
end
|
100
|
-
|
100
|
+
|
101
101
|
# execute the processor
|
102
102
|
def execute(content="", settings={})
|
103
103
|
output = content
|
data/lib/raconteur/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raconteur
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Appleseed
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|