Module: Lustr

Defined in:
lib/lustr/dsl.rb,
lib/lustr/engine.rb,
lib/lustr/gadget.rb,
lib/lustr/widget.rb,
lib/lustr/builder.rb,
lib/lustr/runtime.rb,
lib/lustr/version.rb,
lib/lustr/defaults.rb,
lib/lustr/generator.rb,
lib/lustr/controller.rb,
lib/lustr/blank_slate.rb,
lib/lustr/eval_context.rb,
lib/lustr/parse_context.rb

Overview

This file is part of Lustr (rubyforge.org/projects/lustr).

Copyright © 2007 Mark L. Murphy.

Lustr is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License.

Lustr is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. This file is included in the Ruby gem as License.txt.

Defined Under Namespace

Modules: ControllerBase, Defaults, VERSION, WidgetBase Classes: BlankSlate, BuilderBase, DSL, EvalContext, Gadget, GadgetBuilder, Generator, NullController, ParseContext, Runtime, SimpleBuilder, TemplatedWidget, XmlBasedWidget

Class Method Summary collapse

Class Method Details

.add_dsl_handler(sym, builder) ⇒ Object



25
26
27
28
29
30
# File 'lib/lustr/engine.rb', line 25

def self.add_dsl_handler(sym, builder)
	@builders ||= {}
	@builders[sym]=builder
	builder.type=sym if builder.respond_to?(:type=)
	DSL.add_dsl_method sym
end

.declare(builder) ⇒ Object



17
18
19
# File 'lib/lustr/engine.rb', line 17

def self.declare(builder)
	add_dsl_handler builder.widget_type, builder
end

.defaults(sym) ⇒ Object



21
22
23
# File 'lib/lustr/engine.rb', line 21

def self.defaults(sym)
	Lustr::Defaults.send(sym)
end

.execute(script) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/lustr/engine.rb', line 42

def self.execute(script)
	results=ParseContext.new
	runtime=Runtime.new
	dsl=DSL.new(results, runtime)
	dsl.involve(script)
	runtime.show(results)
end

.generate(options) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/lustr/engine.rb', line 50

def self.generate(options)
	results=ParseContext.new
	generator_klass=options[:generator]
	generator=generator_klass.new(options)
	dsl=DSL.new(results, generator)
	dsl.involve(options[:script])
	generator.generate(results)
end

.get_builder_klass(sym) ⇒ Object



32
33
34
# File 'lib/lustr/engine.rb', line 32

def self.get_builder_klass(sym)
	return @builders[sym]
end

.runObject



36
37
38
39
40
# File 'lib/lustr/engine.rb', line 36

def self.run
	require ARGV[1]

	self.execute(ARGV[0])
end