Class: Swiftfake::Runner

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args:, config: Config.create) ⇒ Runner

Returns a new instance of Runner.



18
19
20
21
# File 'lib/swiftfake.rb', line 18

def initialize(args:, config: Config.create)
  @args = args
  @config = config
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



16
17
18
# File 'lib/swiftfake.rb', line 16

def args
  @args
end

#configObject (readonly)

Returns the value of attribute config.



16
17
18
# File 'lib/swiftfake.rb', line 16

def config
  @config
end

Instance Method Details

#runObject



23
24
25
26
27
28
29
# File 'lib/swiftfake.rb', line 23

def run
  source_file, structure_json = config.source_reader.read_file(args[:input])
  parser = config.parser_klass.new
  swift_class = parser.parse(source_file, structure_json)
  presenter = config.presenter_klass.new(swift_class)
  config.renderer.output(presenter)
end