class Destruct
Constants
- GEMSPEC
- VERSION
Public Class Methods
new(object, *paths, &block)
click to toggle source
# File lib/destruct.rb 12 def initialize(object, *paths, &block) 13 @object = object 14 @paths = paths 15 @block = block || proc { } 16 end
Public Instance Methods
to_h()
click to toggle source
# File lib/destruct.rb 18 def to_h 19 paths.each_with_object(Hash.new) do |path, hash| 20 resolve(path).each do |key, value| 21 hash[key] = value 22 end 23 end 24 end
Private Instance Methods
dsl()
click to toggle source
# File lib/destruct.rb 28 def dsl 29 DSL.new(&@block) 30 end
paths()
click to toggle source
# File lib/destruct.rb 32 def paths 33 @paths + dsl.paths 34 end
resolve(path)
click to toggle source
# File lib/destruct.rb 36 def resolve(path) 37 Resolver.new(@object, path).to_h 38 end