Class: Mumukit::Runner
- Inherits:
-
Object
- Object
- Mumukit::Runner
- Defined in:
- lib/mumukit/runner.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#runtime ⇒ Object
readonly
Returns the value of attribute runtime.
Class Method Summary collapse
Instance Method Summary collapse
- #config ⇒ Object
- #configure {|@config| ... } ⇒ Object
- #configure_runtime(config) ⇒ Object
- #directives_pipeline ⇒ Object
-
#initialize(name) ⇒ Runner
constructor
A new instance of Runner.
- #new_directives_pipeline ⇒ Object
- #new_flags_directive ⇒ Object
- #new_interpolations_directive(key) ⇒ Object
- #new_sections_directive ⇒ Object
- #prefix ⇒ Object
- #reconfigure(&block) ⇒ Object
Constructor Details
#initialize(name) ⇒ Runner
Returns a new instance of Runner.
5 6 7 |
# File 'lib/mumukit/runner.rb', line 5 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/mumukit/runner.rb', line 3 def name @name end |
#runtime ⇒ Object (readonly)
Returns the value of attribute runtime.
3 4 5 |
# File 'lib/mumukit/runner.rb', line 3 def runtime @runtime end |
Class Method Details
.configure_defaults {|@default_config| ... } ⇒ Object
66 67 68 69 |
# File 'lib/mumukit/runner.rb', line 66 def self.configure_defaults @default_config ||= OpenStruct.new yield @default_config end |
.default_config ⇒ Object
62 63 64 |
# File 'lib/mumukit/runner.rb', line 62 def self.default_config @default_config end |
Instance Method Details
#config ⇒ Object
24 25 26 |
# File 'lib/mumukit/runner.rb', line 24 def config @config or raise 'This runner has not being configured yet' end |
#configure {|@config| ... } ⇒ Object
9 10 11 12 |
# File 'lib/mumukit/runner.rb', line 9 def configure @config ||= self.class.default_config.clone yield @config end |
#configure_runtime(config) ⇒ Object
20 21 22 |
# File 'lib/mumukit/runner.rb', line 20 def configure_runtime(config) @runtime = Mumukit::Runtime.new(config) end |
#directives_pipeline ⇒ Object
32 33 34 |
# File 'lib/mumukit/runner.rb', line 32 def directives_pipeline @pipeline ||= new_directives_pipeline end |
#new_directives_pipeline ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/mumukit/runner.rb', line 36 def new_directives_pipeline if config.preprocessor_enabled Mumukit::Directives::Pipeline.new( [new_sections_directive, new_interpolations_directive('test'), new_interpolations_directive('extra'), new_interpolations_directive('content'), new_flags_directive], config.comment_type) else Mumukit::Directives::NullPipeline end end |
#new_flags_directive ⇒ Object
58 59 60 |
# File 'lib/mumukit/runner.rb', line 58 def new_flags_directive Mumukit::Directives::Flags.new end |
#new_interpolations_directive(key) ⇒ Object
50 51 52 |
# File 'lib/mumukit/runner.rb', line 50 def new_interpolations_directive(key) Mumukit::Directives::Interpolations.new(key) end |
#new_sections_directive ⇒ Object
54 55 56 |
# File 'lib/mumukit/runner.rb', line 54 def new_sections_directive Mumukit::Directives::Sections.new nest_sections: Mumukit.config.multifile end |
#prefix ⇒ Object
28 29 30 |
# File 'lib/mumukit/runner.rb', line 28 def prefix name.camelize end |
#reconfigure(&block) ⇒ Object
14 15 16 17 18 |
# File 'lib/mumukit/runner.rb', line 14 def reconfigure(&block) @config = nil @pipeline = nil configure &block end |