hyalite 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d58bd8050435b3431c42a72193bac5e4d6b31e99
4
- data.tar.gz: 115eb893beb63f8e054a6708a749381fb347f615
2
+ SHA256:
3
+ metadata.gz: 97d81068c80477baf4128d88b35389a3d9f25a77cf5bc5f506340fa4472bc8f8
4
+ data.tar.gz: e1eccec6dfc4d0a0672418fe54870d8b1a4916b0880297c648009173b026e36e
5
5
  SHA512:
6
- metadata.gz: 29dd07302e29aaf53e3ae4cb171a2dea290f0bfc461f67cea7cdd1f653bc60d7058006ef4460c67aa9923aed2283aeb45254ce1957f4031d6aff034e7b7047f2
7
- data.tar.gz: ec49f438f12e1a1701ac97b918d076339b09da932cb1e2903ff3adfbf4f7acba9015d557eaab0e8bb04f13d5887ca133f83e296d0c481805925c7704dfa4bfc3
6
+ metadata.gz: aa63333c172b11a3f7f2fa23f4d849437cd1aa26cf7079173f288db8e90af71eee84d699e1669d4d46ab7cfce2c8fc844093c3c92dea5ccf7d220deb0aea9e22
7
+ data.tar.gz: 2db3e64bb316f2f05f394f1d53dd7f6c771a3209758eb30a9e0306e9a53262acfd50e563a4bee853d03f9039c3462d5f4c211d7d9a140080610a1dc8b20925f7
@@ -87,9 +87,10 @@ module Hyalite
87
87
  Hyalite.create_element_hook do |hook_setter|
88
88
  renderer = ChildrenRenderer.new(self, hook_setter)
89
89
  renderer.instance_eval(&block)
90
- children << renderer.children
90
+ children += renderer.children.select{|el| el.is_a?(ElementObject) && el.parent.nil? }
91
91
  end
92
92
  end
93
+
93
94
  Hyalite.create_element(tag, props, *children)
94
95
  end
95
96
  end
@@ -1,6 +1,7 @@
1
1
  module Hyalite
2
2
  class ElementObject
3
3
  attr_reader :type, :key, :ref, :props, :owner
4
+ attr_accessor :parent
4
5
 
5
6
  def initialize(type, key, ref, owner, props)
6
7
  @type = type
@@ -18,7 +18,12 @@ module Hyalite
18
18
 
19
19
  props = {}
20
20
 
21
- if config
21
+ case config
22
+ when String
23
+ children = [config]
24
+ when Array
25
+ children = config
26
+ when Hash
22
27
  key = config[:key]
23
28
  ref = config[:ref]
24
29
 
@@ -38,7 +43,10 @@ module Hyalite
38
43
  children
39
44
  end
40
45
 
41
- ElementObject.new(type, key, ref, Hyalite.current_owner, props).tap {|el| element_created(el) }
46
+ ElementObject.new(type, key, ref, Hyalite.current_owner, props).tap do |el|
47
+ children.each {|child| child.parent = el if child.is_a?(ElementObject) }
48
+ element_created(el)
49
+ end
42
50
  end
43
51
 
44
52
  def element_created(element)
@@ -48,7 +56,7 @@ module Hyalite
48
56
  end
49
57
  end
50
58
 
51
- def create_element_hook(&block)
59
+ def create_element_hook(key, &block)
52
60
  @hooks ||= []
53
61
  hook_setter = HookSetter.new(@hooks)
54
62
  yield hook_setter
@@ -1,3 +1,3 @@
1
1
  module Hyalite
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyalite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - youchan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-13 00:00:00.000000000 Z
11
+ date: 2018-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
@@ -60,7 +60,6 @@ extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
62
  - ".gitignore"
63
- - ".ruby-version"
64
63
  - ".travis.yml"
65
64
  - Gemfile
66
65
  - Gemfile.lock
@@ -145,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
144
  version: '0'
146
145
  requirements: []
147
146
  rubyforge_project:
148
- rubygems_version: 2.5.2
147
+ rubygems_version: 2.7.3
149
148
  signing_key:
150
149
  specification_version: 4
151
150
  summary: Virtual DOM implimentation in Ruby
@@ -1 +0,0 @@
1
- 2.3.3