class Bookfile::Builder
Attributes
bookfile[R]
Public Class Methods
load( code )
click to toggle source
# File lib/bookfile/builder.rb, line 15 def self.load( code ) builder = Builder.new builder.instance_eval( code ) builder end
load_file( path )
click to toggle source
# File lib/bookfile/builder.rb, line 10 def self.load_file( path ) code = File.read_utf8( path ) self.load( code ) end
new()
click to toggle source
# File lib/bookfile/builder.rb, line 24 def initialize puts "starting new bookfile; lets go" @bookfile = Bookfile.new end
Public Instance Methods
beer( opts={} )
click to toggle source
# File lib/bookfile/builder.rb, line 42 def beer( opts={} ) puts "beer opts: #{opts.inspect}" ## todo: to avoid name class use BeerDef, WorldDef ?? etc. @bookfile.databases << BeerDef.new( opts ) end
book( opts={}, &block )
click to toggle source
# File lib/bookfile/builder.rb, line 55 def book( opts={}, &block ) puts "book opts: #{opts.inspect}" @bookfile.books << BookDef.new( opts, block ) end
football( opts={} )
click to toggle source
# File lib/bookfile/builder.rb, line 48 def football( opts={} ) puts "football opts: #{opts.inspect}" @bookfile.databases << FootballDef.new( opts ) end
package( name, opts={} )
click to toggle source
# File lib/bookfile/builder.rb, line 30 def package( name, opts={} ) puts "package '#{name}'" @bookfile.packages << BookPackage.new( name, opts ) end
world( opts={} )
click to toggle source
database options
# File lib/bookfile/builder.rb, line 37 def world( opts={} ) puts "world opts: #{opts.inspect}" @bookfile.databases << WorldDef.new( opts ) end