www_app 2.0.2 → 2.1.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: 0b68703439f6af0d7c3b856f92d150e0f4fa667f
4
- data.tar.gz: 973a336ae0fa58aef0150adf455bb1b645126726
3
+ metadata.gz: 7e7a5f6a10766dce720257078174946f2877ad4c
4
+ data.tar.gz: 9141e1ba84265a5b7cb0edf217cd31b9354fec84
5
5
  SHA512:
6
- metadata.gz: 820e2f0f4d93552d3d047fc9ea9a63df4301186a2a7778d33043f1caec7ed537ba90c1ac6feffbdc87b50d6c4abb241d174997652b10ba762d8c78ebe3d2ed16
7
- data.tar.gz: cd154c9fba1e546a97b638f0619fe6d4d8618e621491a201fc854f3e565891f8d631fc3b8592c7c31367ffd52484bf349a89bc7294dac11f6d9a7f1e4f1dd241
6
+ metadata.gz: 088cff69618d484c4d2bcd878baf7a0fb0d7c2fc6a08d1b477870853f63f72f308a91e122f8786c6e26388893cfaf4d2e639a0ab22ea31fde3f8bf56b4df41a4
7
+ data.tar.gz: ceb4242143e647bf73bf2354cfea69f448817ecc5959feaaef4758b1a4ce54f09387e56dc738bc57cb4b223b451fbf8e121ab82aadce8231a4d503853dc15100
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.2
1
+ 2.1.0
data/lib/www_app.rb CHANGED
@@ -59,14 +59,16 @@ class WWW_App
59
59
  fail ::ArgumentError, "Methods already defined:\n#{MULTI_DEFINED_METHS.inspect}"
60
60
  end
61
61
 
62
+ protected
63
+ attr_reader :blok
64
+
62
65
  private # ===============================================
63
66
 
64
67
  def initialize &blok
65
68
  @html_ids = {}
66
69
  @tags = []
67
70
  @tag = nil
68
-
69
- instance_eval &blok
71
+ @blok = blok
70
72
  end
71
73
 
72
74
  def SPACES indent
@@ -97,6 +99,10 @@ class WWW_App
97
99
  return [tags, tag, syms]
98
100
  end
99
101
 
102
+ def use www_app
103
+ instance_eval &(www_app.blok)
104
+ end
105
+
100
106
  def de_ref tag
101
107
  t_name = tag[:tag_name]
102
108
  return tag unless t_name == :_
data/lib/www_app/TO.rb CHANGED
@@ -144,6 +144,7 @@ class WWW_App
144
144
  }
145
145
 
146
146
  def to_raw_text
147
+ instance_eval(&@blok) if @tags.empty?
147
148
  str = ""
148
149
  indent = 0
149
150
  print_tag = lambda { |t|
@@ -166,6 +167,7 @@ class WWW_App
166
167
 
167
168
  def to_html *args
168
169
  return @mustache.render(*args) if instance_variable_defined?(:@mustache)
170
+ instance_eval(&@blok) if @tags.empty?
169
171
 
170
172
  final = ""
171
173
  indent = 0
@@ -0,0 +1,26 @@
1
+
2
+ describe :use do
3
+
4
+ it "inserts another WWW_App inside" do
5
+ nav = WWW_App.new {
6
+ div.^(:nav_bar) {
7
+ a.href('/') { 'Home' }
8
+ }
9
+ }
10
+
11
+ target :body, <<-EOF
12
+ <div id="main">
13
+ <div class="nav_bar">
14
+ <a href="&#47;">Home</a>
15
+ </div>
16
+ </div>
17
+ EOF
18
+
19
+ actual {
20
+ div.id(:main) {
21
+ use nav
22
+ }
23
+ }
24
+ end # === it inserts another WWW_App inside
25
+
26
+ end # === describe :use
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: www_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - da99
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-21 00:00:00.000000000 Z
11
+ date: 2015-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yajl-ruby
@@ -248,6 +248,7 @@ files:
248
248
  - specs/server-side/0041-font_family.rb
249
249
  - specs/server-side/0041-pseudo.rb
250
250
  - specs/server-side/0042-slash.rb
251
+ - specs/server-side/0050-use.rb
251
252
  - specs/server-side/0060-text.rb
252
253
  - www_app.gemspec
253
254
  homepage: https://github.com/da99/www_app