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 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
- Besides calling .attribute, you can ask for all attributes:
61
+ h3. .attributes
62
62
 
63
- <pre>@at.attributes</pre> returns a hash <pre>{"mbc" => ActiveText::Variable, "mbc2" => ActiveText::Variable}</pre>
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.5
1
+ 0.0.6
data/active_text.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{active_text}
8
- s.version = "0.0.5"
8
+ s.version = "0.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ramon Tayag"]
@@ -14,10 +14,12 @@ module ActiveText
14
14
  @options = options
15
15
 
16
16
  # instantiate all variables
17
- @text.scan(/^\${1}(.+): .+;/).flatten.each do |variable_name|
18
- if has_context?(variable_name)
19
- variable = ActiveText::Variable.new(variable_name, context_of(variable_name), @options[:comment])
20
- @variables.merge!({variable_name.to_sym => variable})
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
@@ -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: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ramon Tayag