Class: AtCoderFriends::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/at_coder_friends/context.rb

Overview

Holds applicaion global information

  • command line options

  • target path

  • configuration

  • application modules

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, path) ⇒ Context

Returns a new instance of Context.



12
13
14
15
# File 'lib/at_coder_friends/context.rb', line 12

def initialize(options, path)
  @options = options
  @path_info = PathInfo.new(File.expand_path(path))
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/at_coder_friends/context.rb', line 10

def options
  @options
end

#path_infoObject (readonly)

Returns the value of attribute path_info.



10
11
12
# File 'lib/at_coder_friends/context.rb', line 10

def path_info
  @path_info
end

Instance Method Details

#configObject



21
22
23
# File 'lib/at_coder_friends/context.rb', line 21

def config
  @config ||= ConfigLoader.load_config(self)
end

#emitterObject



33
34
35
# File 'lib/at_coder_friends/context.rb', line 33

def emitter
  @emitter ||= Emitter.new(self)
end

#generatorObject



29
30
31
# File 'lib/at_coder_friends/context.rb', line 29

def generator
  @generator ||= Generator::Main.new(self)
end

#judge_test_runnerObject



41
42
43
# File 'lib/at_coder_friends/context.rb', line 41

def judge_test_runner
  @judge_test_runner ||= TestRunner::Judge.new(self)
end

#pathObject



17
18
19
# File 'lib/at_coder_friends/context.rb', line 17

def path
  path_info.path
end

#post_processObject



49
50
51
# File 'lib/at_coder_friends/context.rb', line 49

def post_process
  @scraping_agent&.save_session
end

#sample_test_runnerObject



37
38
39
# File 'lib/at_coder_friends/context.rb', line 37

def sample_test_runner
  @sample_test_runner ||= TestRunner::Sample.new(self)
end

#scraping_agentObject



25
26
27
# File 'lib/at_coder_friends/context.rb', line 25

def scraping_agent
  @scraping_agent ||= Scraping::Agent.new(self)
end

#verifierObject



45
46
47
# File 'lib/at_coder_friends/context.rb', line 45

def verifier
  @verifier ||= Verifier.new(self)
end