foundation-navigation 0.0.1 → 0.0.2

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
2
  SHA1:
3
- metadata.gz: d2a35b69cf278dece4d6297425827fdb86b37bf3
4
- data.tar.gz: bd0c50cf7338dbc6f47a13298356c53e98600cca
3
+ metadata.gz: 25f21033def3669bb8b5e6eb377ada00c0df8d4a
4
+ data.tar.gz: 246a9e4303a9432f5486fb88e0a8cfd6dcb215a7
5
5
  SHA512:
6
- metadata.gz: 41e2bdf473a2c2d7fe4f282cde2ca87d6ccdaf4c3399bd8baaf7d35a8fae6e84bc0e1dd535574f1bbe55eecc90f6e4c9a100d32e544ca9f5e13c009ff2538f3e
7
- data.tar.gz: 5f1d984067389d40f2023c18e9a3324c93f537c504a9487f2bdc23c5f03a9b350b9248cbbddfd15462ed6e09b2b3c8509381ba03f1390a52111be3ffeea7f39a
6
+ metadata.gz: cc9a4e68bd5b846192e78d4f0c8391321fb333c96c82b20954a8354faf284b29e33f1cc3f87f4225e50ad5b0aeba0d05a86651eb65318826fc8e0fbc301b57bd
7
+ data.tar.gz: 4390f1befb564d68210afb41f8ea74a26f47731eb0048a6ed94095e4999f0ebc69630a68ec064ae859a9369f2acac5c44af975ae97972ac635142009f43b3628
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.0.2 (2013-09-10)
2
+
3
+ * Keep original context and delegate non-whitelisted dsl methods
4
+
1
5
  ## 0.0.1 (2013-09-02)
2
6
 
3
7
  * Initial release
@@ -44,11 +44,21 @@ module FoundationNavigation
44
44
  @node.to_s
45
45
  end
46
46
 
47
- def method_missing(name, opts = {}, &block)
47
+ def method_missing(method, *args, &block)
48
+ if %i(li ul nav div h1 a span section).include? method
49
+ add_node(method, *args, &block)
50
+ else
51
+ @self_before_instance_eval.send(method, *args, &block)
52
+ end
53
+ end
54
+
55
+ private
56
+ def add_node(name, *opts, &block)
48
57
  parent = @node
49
- @node = Node.new(parent, name, opts)
58
+ @node = Node.new(parent, name, *opts)
50
59
  parent.children << @node if parent
51
60
  if block_given?
61
+ @self_before_instance_eval = eval "self", block.binding
52
62
  val = instance_eval(&block)
53
63
  @node.children << val if val.is_a?(String)
54
64
  end
@@ -11,11 +11,7 @@ module FoundationNavigation
11
11
  def initialize(title, link = '#', &block)
12
12
  li(class: 'has-dropdown not-click') do
13
13
  a(href: link) { title }
14
- ul(class: 'dropdown') do
15
- if block_given?
16
- instance_eval(&block)
17
- end
18
- end
14
+ ul(class: 'dropdown', &block)
19
15
  end
20
16
  end
21
17
  end
@@ -9,11 +9,7 @@ module FoundationNavigation
9
9
  def initialize(orientation: nil, &block)
10
10
  params = {}
11
11
  params[:class] = orientation if orientation.present?
12
- ul(params) do
13
- if block_given?
14
- self.instance_eval(&block)
15
- end
16
- end
12
+ ul(params, &block)
17
13
  end
18
14
  end
19
15
 
@@ -10,11 +10,7 @@ module FoundationNavigation
10
10
  def navigation(**args, &block)
11
11
  nav(class: 'top-bar') do
12
12
  build_subtree(FoundationNavigation::TitleArea, **args)
13
- section(class: 'top-bar-section') do
14
- if block_given?
15
- self.instance_eval(&block)
16
- end
17
- end
13
+ section(class: 'top-bar-section', &block)
18
14
  end
19
15
  end
20
16
 
@@ -1,3 +1,3 @@
1
1
  module FoundationNavigation
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foundation-navigation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian de Castelberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-02 00:00:00.000000000 Z
11
+ date: 2013-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler