Class: Mumukit::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/mumukit/runner.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/mumukit/runner.rb', line 3

def name
  @name
end

#runtimeObject (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

Yields:



48
49
50
51
# File 'lib/mumukit/runner.rb', line 48

def self.configure_defaults
  @default_config ||= OpenStruct.new
  yield @default_config
end

.default_configObject



44
45
46
# File 'lib/mumukit/runner.rb', line 44

def self.default_config
  @default_config
end

Instance Method Details

#configObject



18
19
20
# File 'lib/mumukit/runner.rb', line 18

def config
  @config or raise 'This runner has not being configured yet'
end

#configure {|@config| ... } ⇒ Object

Yields:



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



14
15
16
# File 'lib/mumukit/runner.rb', line 14

def configure_runtime(config)
  @runtime = Mumukit::Runtime.new(config)
end

#directives_pipelineObject



26
27
28
# File 'lib/mumukit/runner.rb', line 26

def directives_pipeline
  @pipeline ||= new_directives_pipeline
end

#new_directives_pipelineObject



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/mumukit/runner.rb', line 30

def new_directives_pipeline
  if config.preprocessor_enabled
    Mumukit::Directives::Pipeline.new(
        [Mumukit::Directives::Sections.new,
         Mumukit::Directives::Interpolations.new('test'),
         Mumukit::Directives::Interpolations.new('extra'),
         Mumukit::Directives::Interpolations.new('content'),
         Mumukit::Directives::Flags.new],
        config.comment_type)
  else
    Mumukit::Directives::NullPipeline
  end
end

#prefixObject



22
23
24
# File 'lib/mumukit/runner.rb', line 22

def prefix
  name.camelize
end