active_text 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +2 -2
- data/VERSION +1 -1
- data/active_text.gemspec +1 -1
- data/lib/active_text/base.rb +6 -4
- data/spec/active_text_spec.rb +5 -2
- metadata +3 -3
data/README.textile
CHANGED
@@ -58,9 +58,9 @@ You can also mass update: <pre>@at.update_attributes(:bg_image => %Q("http://ano
|
|
58
58
|
|
59
59
|
h2. Methods
|
60
60
|
|
61
|
-
|
61
|
+
h3. .attributes
|
62
62
|
|
63
|
-
<pre>@at.attributes</pre> returns a hash <pre>{"mbc" =>
|
63
|
+
<pre>@at.attributes</pre> returns a hash <pre>{"mbc" => value_of_mbc, "mbc2" => value_of_mbc2}</pre>
|
64
64
|
|
65
65
|
h2. Gotchas
|
66
66
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/active_text.gemspec
CHANGED
data/lib/active_text/base.rb
CHANGED
@@ -14,10 +14,12 @@ module ActiveText
|
|
14
14
|
@options = options
|
15
15
|
|
16
16
|
# instantiate all variables
|
17
|
-
@text
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
if @text
|
18
|
+
@text.scan(/^\${1}(.+): .+;/).flatten.each do |variable_name|
|
19
|
+
if has_context?(variable_name)
|
20
|
+
variable = ActiveText::Variable.new(variable_name, context_of(variable_name), @options[:comment])
|
21
|
+
@variables.merge!({variable_name.to_sym => variable})
|
22
|
+
end
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
data/spec/active_text_spec.rb
CHANGED
@@ -82,8 +82,7 @@ $mbc: #555;}
|
|
82
82
|
|
83
83
|
describe ".attributes" do
|
84
84
|
it ".attributes should return an empty hash when there are no valid variables" do
|
85
|
-
@text = %{
|
86
|
-
$mbc2: "http://someurl.com/image.jpg";
|
85
|
+
@text = %{$mbc2: "http://someurl.com/image.jpg";
|
87
86
|
$mbc: #555;}
|
88
87
|
@s = ActiveText::Base.new(@text)
|
89
88
|
@s.attributes.should == {}
|
@@ -137,4 +136,8 @@ $mbc2: "http://someurl.com/image.jpg";
|
|
137
136
|
@s.mbc2 = nil
|
138
137
|
@s.mbc2.should == %Q("http://someurl.com/image.jpg")
|
139
138
|
end
|
139
|
+
|
140
|
+
it "should still work if there is no text" do
|
141
|
+
ActiveText::Base.new(nil).attributes.should be_empty
|
142
|
+
end
|
140
143
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_text
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ramon Tayag
|