roda-component 0.1.4 → 0.1.5

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: 7614d381de0639ca41a6ff74d51e48fbcb6c580e
4
- data.tar.gz: cc8674a7ac3c28889c04235d176200efd99908f4
3
+ metadata.gz: 6709c88bb551e2d62fc3991f8faaec4d71f5105e
4
+ data.tar.gz: 8487b6adbe4e685e24bb7184632f6547dd34ac59
5
5
  SHA512:
6
- metadata.gz: 83bc086bbd65feb744d35dd061c8c9c67d72d27146cb40b2b5b3fb21b2322070764fdf2027b420ef9a9fce3cb13d14cc06ea1aafba9f2effe77aa1525c395fa9
7
- data.tar.gz: f192e0a211099639cc75fa2c2d74a9273741b2a52567d470df918e860c5811c1f1f7ce3905c6f5138f4db24692b138768eb81775a080886382c1d9770c58d393
6
+ metadata.gz: b054a490aac393f350a01c8a3bd9986d94e3f1365f0aabe6ea5b2b4bb7239a82173341837aeb2a520f33fe5fe3b3222f3495afb51375d92d452b804335e3b7e2
7
+ data.tar.gz: a896624d7dfd0734d2a90abaf80a81bfae32e7bc27b2d2514e1cfdfd916b689b493df230048b18c1997dd8e8ba9330ea907a71c758d6f1ba41b4216b5b48b189
@@ -1,20 +1,16 @@
1
- require 'delegate'
2
-
3
1
  class Roda
4
2
  class Component
5
- class DOM < SimpleDelegator
3
+ class DOM
6
4
  attr_accessor :dom, :raw_html
7
5
 
8
6
  def initialize html
9
- @raw_html = html.dup
7
+ @raw_html = html
10
8
 
11
9
  if server?
12
10
  @dom = Component::HTML(raw_html)
13
11
  else
14
12
  @dom = raw_html.is_a?(String) ? Element[raw_html] : raw_html
15
13
  end
16
-
17
- super dom
18
14
  end
19
15
 
20
16
  def find string, &block
@@ -38,7 +34,11 @@ class Roda
38
34
  end
39
35
  end
40
36
 
41
- node
37
+ if server?
38
+ self
39
+ else
40
+ node
41
+ end
42
42
  end
43
43
 
44
44
  def html= content
@@ -54,7 +54,7 @@ class Roda
54
54
  def html content = false
55
55
  if !content
56
56
  if server?
57
- node.to_html
57
+ node.inner_html
58
58
  else
59
59
  node ? node.html : dom.html
60
60
  end
@@ -67,6 +67,17 @@ class Roda
67
67
  @node || dom
68
68
  end
69
69
 
70
+ # This allows you to use all the nokogiri or opal jquery methods if a
71
+ # global one isn't set
72
+ def method_missing method, *args, &block
73
+ # respond_to?(symbol, include_all=false)
74
+ if dom.respond_to? method, true
75
+ dom.send method, *args, &block
76
+ else
77
+ super
78
+ end
79
+ end
80
+
70
81
  private
71
82
 
72
83
  def server? &block
@@ -1,5 +1,5 @@
1
1
  class Roda
2
2
  class Component
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roda-component
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - cj