Class: OpenDsl::Builder
- Inherits:
-
Object
- Object
- OpenDsl::Builder
- Defined in:
- lib/open_dsl/builder.rb
Class Method Summary collapse
Instance Method Summary collapse
- #context ⇒ Object
-
#initialize(file = nil, &blk) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(file = nil, &blk) ⇒ Builder
Returns a new instance of Builder.
8 9 10 11 12 13 14 15 16 |
# File 'lib/open_dsl/builder.rb', line 8 def initialize(file = nil, &blk) if file build_from_file(file) elsif blk build_from_proc(blk) else raise "OpenDsl#new requires either a file to load or a block as an argument" end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Class Method Details
.build(file = nil, &blk) ⇒ Object
3 4 5 6 |
# File 'lib/open_dsl/builder.rb', line 3 def self.build(file = nil, &blk) builder = new(file, &blk) builder.context.toplevel_object end |
Instance Method Details
#context ⇒ Object
18 19 20 |
# File 'lib/open_dsl/builder.rb', line 18 def context @context end |