Class: Bookfile::Builder
- Inherits:
-
Object
- Object
- Bookfile::Builder
- Defined in:
- lib/bookfile/builder.rb
Instance Attribute Summary collapse
-
#bookfile ⇒ Object
readonly
Returns the value of attribute bookfile.
Class Method Summary collapse
- .load(code) ⇒ Object
-
.load_file(path) ⇒ Object
include LogUtils::Logging.
Instance Method Summary collapse
- #book(opts = {}, &block) ⇒ Object
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
- #package(name, opts = {}) ⇒ Object
- #world(opts = {}) ⇒ Object
Constructor Details
#initialize ⇒ Builder
Returns a new instance of Builder.
24 25 26 27 |
# File 'lib/bookfile/builder.rb', line 24 def initialize puts "starting new bookfile; lets go" @bookfile = Bookfile.new end |
Instance Attribute Details
#bookfile ⇒ Object (readonly)
Returns the value of attribute bookfile.
22 23 24 |
# File 'lib/bookfile/builder.rb', line 22 def bookfile @bookfile end |
Class Method Details
.load(code) ⇒ Object
15 16 17 18 19 |
# File 'lib/bookfile/builder.rb', line 15 def self.load( code ) builder = Builder.new builder.instance_eval( code ) builder end |
.load_file(path) ⇒ Object
include LogUtils::Logging
10 11 12 13 |
# File 'lib/bookfile/builder.rb', line 10 def self.load_file( path ) code = File.read( path ) self.load( code ) end |
Instance Method Details
#book(opts = {}, &block) ⇒ Object
40 41 42 43 |
# File 'lib/bookfile/builder.rb', line 40 def book( opts={}, &block ) puts "book opts: #{opts.inspect}" @bookfile.books << BookDef.new( opts, block ) end |
#package(name, opts = {}) ⇒ Object
30 31 32 33 |
# File 'lib/bookfile/builder.rb', line 30 def package( name, opts={} ) puts "package '#{name}'" @bookfile.packages << BookPackage.new( name, opts ) end |
#world(opts = {}) ⇒ Object
35 36 37 38 |
# File 'lib/bookfile/builder.rb', line 35 def world( opts={} ) puts "world opts: #{opts.inspect}" @bookfile.databases << World.new( opts ) end |