tiny 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/lib/tiny.rb CHANGED
@@ -409,13 +409,14 @@ module Tiny
409
409
  # @see Widget.
410
410
  #
411
411
  def render &block
412
- with_buffer do
412
+ output = with_buffer do
413
413
  next markup unless block_given?
414
414
  markup do |args|
415
415
  context = eval('self', block.binding)
416
416
  append! context.instance_eval{ with_buffer(*args, &block) }
417
417
  end
418
418
  end
419
+ SafeString.new output
419
420
  end
420
421
  alias to_html render
421
422
  end
data/lib/tiny/tag.rb CHANGED
@@ -11,7 +11,7 @@ module Tiny
11
11
 
12
12
  def tag_attributes
13
13
  tag_attrs = attrs.map do |name, val|
14
- next if val.nil? || val == []
14
+ next if val.nil? || val == [] || val == false
15
15
  next name if val == true
16
16
 
17
17
  vals = [*val].map do |value|
data/lib/tiny/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tiny
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
data/spec/helpers_spec.rb CHANGED
@@ -30,6 +30,11 @@ describe 'markup helpers' do
30
30
  output.should == "<li data-something></li>"
31
31
  end
32
32
 
33
+ it 'should not emit value if value is false' do
34
+ output = tag(:li, 'data-something' => false)
35
+ output.should == "<li></li>"
36
+ end
37
+
33
38
  it 'should not allow passing text without #text' do
34
39
  output = tag(:li) { 'Hello' }
35
40
  output.should == '<li></li>'
data/spec/widget_spec.rb CHANGED
@@ -17,6 +17,7 @@ describe Tiny::Widget do
17
17
  end
18
18
  end.new.to_html
19
19
  output.should == "<div></div>\n"
20
+ output.should be_html_safe
20
21
  end
21
22
 
22
23
  it 'should output content with block' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-19 00:00:00.000000000 Z
12
+ date: 2012-09-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: tilt