Module: DSeL::DSL::Nodes::APIBuilder::Environment
- Includes:
- Base::Environment
- Defined in:
- lib/dsel/dsl/nodes/api_builder/environment.rb
Constant Summary
Base::Environment::DSEL_NODE_ACCESSOR, Base::Environment::DSEL_NODE_IVAR
Instance Method Summary
collapse
#Parent, #Root, #_dsel_self, #_dsel_shared_variables, #_dsel_variables, #instance_variables
Instance Method Details
#_dsel_caller_dir(offset = 1) ⇒ Object
47
48
49
|
# File 'lib/dsel/dsl/nodes/api_builder/environment.rb', line 47
def _dsel_caller_dir( offset = 1 )
File.dirname( caller[offset].split( ':', 2 ).first ) << '/'
end
|
#_dsel_import(file) ⇒ Object
43
44
45
|
# File 'lib/dsel/dsl/nodes/api_builder/environment.rb', line 43
def _dsel_import( file )
_dsel_node.subject.instance_eval( IO.read( file ) )
end
|
#child(method_name, class_name, *args, &block) ⇒ Object
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/dsel/dsl/nodes/api_builder/environment.rb', line 32
def child( method_name, class_name, *args, &block )
node = _dsel_node.node_for( class_name )
node.run( &block )
_dsel_node.subject.push_child(
method_name,
node.subject,
*args
)
end
|
#import(file) ⇒ Object
9
10
11
12
13
14
|
# File 'lib/dsel/dsl/nodes/api_builder/environment.rb', line 9
def import( file )
f = file.dup
f << '.rb' if !file.end_with?( '.rb' )
_dsel_import f
end
|
#import_many(glob) ⇒ Object
16
17
18
|
# File 'lib/dsel/dsl/nodes/api_builder/environment.rb', line 16
def import_many( glob )
Dir["#{glob}.rb"].each { |file| _dsel_import( file ) }
end
|
#import_relative(file) ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/dsel/dsl/nodes/api_builder/environment.rb', line 20
def import_relative( file )
f = _dsel_caller_dir
f << file
f << '.rb' if !file.end_with?( '.rb' )
_dsel_import f
end
|
#import_relative_many(glob) ⇒ Object
28
29
30
|
# File 'lib/dsel/dsl/nodes/api_builder/environment.rb', line 28
def import_relative_many( glob )
Dir["#{_dsel_caller_dir}#{glob}.rb"].each { |file| _dsel_import( file ) }
end
|