class Destruct::DSL

Public Class Methods

new(&block) click to toggle source
  # File lib/destruct/dsl.rb
3 def initialize(&block)
4   @paths = []
5   instance_eval(&block) if block
6 end

Public Instance Methods

[](path) click to toggle source
   # File lib/destruct/dsl.rb
 8 def [](path)
 9   self.class.new.tap do |dsl|
10     @paths << [path, dsl]
11   end
12 end
paths() click to toggle source
   # File lib/destruct/dsl.rb
14 def paths
15   @paths.each_with_object([]) do |(key, dsl), paths|
16     nested = dsl.paths
17     paths << [key] if nested.empty?
18     nested.each { |path| paths << path.unshift(key) }
19   end
20 end

Private Instance Methods

method_missing(method, *) click to toggle source
   # File lib/destruct/dsl.rb
24 def method_missing(method, *)
25   self[method]
26 end
respond_to_missing?(method, *) click to toggle source
   # File lib/destruct/dsl.rb
28 def respond_to_missing?(method, *)
29   true
30 end