sinatra-bells 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4d8d747f1dbcd4fe39bd55d5cf787e5bf537e4f
4
- data.tar.gz: a44048ea6c7d6081f13acd8d6d1313f6c2519753
3
+ metadata.gz: 8c06a119e890338c06263a4ff633d48408783cb3
4
+ data.tar.gz: 0caaea6341e20b1525125caaafa6562613a2aa54
5
5
  SHA512:
6
- metadata.gz: 074d45d14568d8a136182dcfc2fd7e437a94a5611d3e9aaba8ac7d2d12d9ef419e9cfd7e4289c466f534590236c689638322175a24add8e2a57c29d3d468a76b
7
- data.tar.gz: 550a3e97a9b0b8de15e48b8adaa643eb17d73225fee004270099f108f66bbaa89b44210c26870561ae817456ef3b76ff290a5ea73685d61e1647f16354abaa66
6
+ metadata.gz: f8582be5383ef42c876b695810905a058df03bfefb82b03e57841c67fefd9028707712f7876663c68bdb1bc3f1d611dace8773b075de8e0d5fce6856456351b2
7
+ data.tar.gz: a0e5f7574fd1c043bc8d67ed4141b0f2a2feb52933bad982756f5b422a64503b1c7cc5742725ee82457a1d6a8c8111e347e903a3a96c726c492ae7120e00db84
data/ChangeLog CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  = Revision history for sinatra-bells
4
4
 
5
+ == 0.4.0 [2016-06-06]
6
+
7
+ * Prevent Sinatra's hash merge behaviour in Sinatra::Bells.set.
8
+ * Added Sinatra::Bells::Helpers::View#tag__ and HTML element helpers.
9
+
5
10
  == 0.3.0 [2016-01-28]
6
11
 
7
12
  * Added Sinatra::Bells::Helpers::View#partial.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to sinatra-bells version 0.3.0
5
+ This documentation refers to sinatra-bells version 0.4.0
6
6
 
7
7
 
8
8
  == DESCRIPTION
data/lib/sinatra/bells.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  # #
6
6
  # sinatra-bells -- Sinatra with some more bells and whistles #
7
7
  # #
8
- # Copyright (C) 2014-2015 Jens Wille #
8
+ # Copyright (C) 2014-2016 Jens Wille #
9
9
  # #
10
10
  # Authors: #
11
11
  # Jens Wille <jens.wille@gmail.com> #
@@ -35,9 +35,9 @@ module Sinatra
35
35
  class << self
36
36
 
37
37
  def set(option, *args, &block)
38
- block ? !args.empty? ?
38
+ block ? args.empty? ? set_defer(option, &block) :
39
39
  raise(ArgumentError, 'both block and arguments given') :
40
- set_defer(option, &block) : super(option, *args, &nil)
40
+ (set(option, nil) if args.first.is_a?(Hash); super(option, *args))
41
41
  end
42
42
 
43
43
  def set_defer(option, &block)
@@ -68,6 +68,10 @@ class Sinatra::Bells
68
68
  def #{name}_(*args, &block)
69
69
  tag_(#{name.inspect}, *args, &block)
70
70
  end
71
+
72
+ def #{name}__(*args)
73
+ tag__(#{name.inspect}, *args)
74
+ end
71
75
  EOT
72
76
  }
73
77
  end
@@ -86,6 +90,10 @@ class Sinatra::Bells
86
90
 
87
91
  tag_(#{name.inspect}, *args, &block)
88
92
  end
93
+
94
+ def #{name}__(*args)
95
+ tag__(#{name.inspect}, *args)
96
+ end
89
97
  EOT
90
98
  }
91
99
  end
@@ -120,6 +128,12 @@ class Sinatra::Bells
120
128
  end
121
129
 
122
130
  def tag_(name, *args)
131
+ tag__(name, *args)
132
+ yield args if block_given?
133
+ args.push('</', name, '>').join
134
+ end
135
+
136
+ def tag__(name, *args)
123
137
  args.unshift('<', name, '>')
124
138
 
125
139
  if args.last.is_a?(Hash)
@@ -127,9 +141,7 @@ class Sinatra::Bells
127
141
  args.insert(2, ' ', attr.join(' ')) unless attr.empty?
128
142
  end
129
143
 
130
- yield args if block_given?
131
-
132
- args.push('</', name, '>').join
144
+ args.join
133
145
  end
134
146
 
135
147
  define_html_tag_method(*HTML_ELEMENTS)
@@ -5,7 +5,7 @@ module Sinatra
5
5
  module Version
6
6
 
7
7
  MAJOR = 0
8
- MINOR = 3
8
+ MINOR = 4
9
9
  TINY = 0
10
10
 
11
11
  class << self
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-bells
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Wille
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-28 00:00:00.000000000 Z
11
+ date: 2016-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '0.8'
34
34
  - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: 0.8.3
36
+ version: 0.8.5
37
37
  type: :development
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0.8'
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 0.8.3
46
+ version: 0.8.5
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -83,13 +83,14 @@ licenses:
83
83
  metadata: {}
84
84
  post_install_message: |2+
85
85
 
86
- sinatra-bells-0.3.0 [2016-01-28]:
86
+ sinatra-bells-0.4.0 [2016-06-06]:
87
87
 
88
- * Added Sinatra::Bells::Helpers::View#partial.
88
+ * Prevent Sinatra's hash merge behaviour in Sinatra::Bells.set.
89
+ * Added Sinatra::Bells::Helpers::View#tag__ and HTML element helpers.
89
90
 
90
91
  rdoc_options:
91
92
  - "--title"
92
- - sinatra-bells Application documentation (v0.3.0)
93
+ - sinatra-bells Application documentation (v0.4.0)
93
94
  - "--charset"
94
95
  - UTF-8
95
96
  - "--line-numbers"
@@ -110,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
111
  version: '0'
111
112
  requirements: []
112
113
  rubyforge_project:
113
- rubygems_version: 2.5.1
114
+ rubygems_version: 2.6.4
114
115
  signing_key:
115
116
  specification_version: 4
116
117
  summary: Sinatra with some more bells and whistles.