Module: Pathtree
- Defined in:
- lib/pathtree.rb,
lib/pathtree/dsl.rb,
lib/pathtree/trunk.rb,
lib/pathtree/version.rb
Overview
Pathname DSL
Defined Under Namespace
Modules: Dsl Classes: MethodDuplicationError, Trunk
Constant Summary collapse
- VERSION =
'0.4.1'
Class Method Summary collapse
-
.load(dsl, root: nil) ⇒ Object
Load Pathtree DSL source.
-
.read(path, root: nil) ⇒ Object
Read Pathtree DSL from
path
.
Class Method Details
.load(dsl, root: nil) ⇒ Object
Load Pathtree DSL source. root
is base directory for tree.
19 20 21 |
# File 'lib/pathtree.rb', line 19 def self.load(dsl, root: nil) (root ? to_path(root) : Trunk.new).tap { _1.instance_eval(dsl) } end |
.read(path, root: nil) ⇒ Object
Read Pathtree DSL from path
. root
is base directory for tree.
12 13 14 15 |
# File 'lib/pathtree.rb', line 12 def self.read(path, root: nil) dsl = File.read(path) self.load(dsl, root: root) end |