Class: DslContext
- Inherits:
-
Object
show all
- Defined in:
- lib/DSLContext.rb
Direct Known Subclasses
CollesceProductInterpreter, CoverageInterpreter, CoverageInterpreter2, DataModelInterpreter, LayoutInterpreter, ProductInterpreter, ProductInterpreter2, RailsProcessInterpreter, RatingEngineResolver, SiteProcessInterpreter, VPMSComponentSchemaInterpreter, VPMSPackageSchemaInterpreter, VPMSProductSchemaInterpreter, VPMSSchemaInterpreter
Class Method Summary
collapse
Class Method Details
.bubble(*methods) ⇒ Object
23
24
25
26
27
|
# File 'lib/DSLContext.rb', line 23
def self.bubble(*methods)
methods.each do |method|
define_method(method) {}
end
end
|
.execute(*args) ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/DSLContext.rb', line 2
def self.execute(*args)
rules = polish_text(args[0])
inst = (args.length > 1) ? self.new(args.slice(1,1)) : self.new
rules.each do |rule|
result = inst.instance_eval(rule)
yield result if block_given?
end
inst.getResult
end
|
.polish_text(text) ⇒ Object
16
17
18
19
20
21
|
# File 'lib/DSLContext.rb', line 16
def self.polish_text(text)
rules = text.split("\n")
rules.collect do |rule|
rule << " "
end
end
|