Class: IOSGen::Generator::BaseGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/ios_gen/generator/base_generator.rb

Overview

Base Generator

Constant Summary collapse

VIEWCONTROLLER_KEY =
'view_controller'
VIEWMODEL_KEY =
'view_model'
INTERACTORS_KEY =
'interactors'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ BaseGenerator

Returns a new instance of BaseGenerator.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ios_gen/generator/base_generator.rb', line 16

def initialize(hash = {})
  @type = hash[:type]
  @file_spec = hash[:file_spec]
  @destination = hash[:destination]
  @factory = IOSGen::Base::BaseFactory.new
  interactor_formatter = Objc::InteractorFormatter.new
  view_model_formatter = Objc::ViewModelFormatter.new(interactor_formatter)
  view_controller_formatter = Objc::ViewControllerFormatter.new(view_model_formatter)
  @formatter = Objc::Formatter.new(view_controller_formatter, view_model_formatter, interactor_formatter)
  parse
end

Instance Attribute Details

#destinationObject (readonly)

Returns the value of attribute destination.



12
13
14
# File 'lib/ios_gen/generator/base_generator.rb', line 12

def destination
  @destination
end

#factoryObject (readonly)

Returns the value of attribute factory.



14
15
16
# File 'lib/ios_gen/generator/base_generator.rb', line 14

def factory
  @factory
end

#file_specObject (readonly)

Returns the value of attribute file_spec.



12
13
14
# File 'lib/ios_gen/generator/base_generator.rb', line 12

def file_spec
  @file_spec
end

#formatterObject (readonly)

Returns the value of attribute formatter.



14
15
16
# File 'lib/ios_gen/generator/base_generator.rb', line 14

def formatter
  @formatter
end

#typeObject (readonly)

Returns the value of attribute type.



12
13
14
# File 'lib/ios_gen/generator/base_generator.rb', line 12

def type
  @type
end

#view_controllerObject (readonly)

Returns the value of attribute view_controller.



13
14
15
# File 'lib/ios_gen/generator/base_generator.rb', line 13

def view_controller
  @view_controller
end

#view_modelObject (readonly)

Returns the value of attribute view_model.



13
14
15
# File 'lib/ios_gen/generator/base_generator.rb', line 13

def view_model
  @view_model
end

Instance Method Details

#generateObject



28
29
30
# File 'lib/ios_gen/generator/base_generator.rb', line 28

def generate
  generate_view_model
end