class IOSGen::Base::BaseFactory
Create base object from json
Constants
- ACTIONS_KEY
- ARGUMENTS_KEY
- DESCRIPTION_KEY
- INTERACTORS_KEY
- NAME_KEY
- PROPERTIES_KEY
- RETURN_KEY
- TYPE_KEY
Public Instance Methods
parse_action(hash)
click to toggle source
# File lib/ios_gen/base/base_factory.rb, line 18 def parse_action(hash) Action.new(description: hash[DESCRIPTION_KEY], name: hash[NAME_KEY], return_type: hash[RETURN_KEY], arguments: parse_properties(hash[ARGUMENTS_KEY])) end
parse_actions(actions)
click to toggle source
# File lib/ios_gen/base/base_factory.rb, line 49 def parse_actions(actions) return if actions.nil? actions_array = [] actions.each do |action| actions_array.push(parse_action(action)) end actions_array end
parse_interactor(hash)
click to toggle source
# File lib/ios_gen/base/base_factory.rb, line 25 def parse_interactor(hash) Interactor.new(description: hash[DESCRIPTION_KEY], name: hash[NAME_KEY], properties: parse_properties(hash[PROPERTIES_KEY]), actions: parse_actions(hash[ACTIONS_KEY])) end
parse_interactors(interactors)
click to toggle source
# File lib/ios_gen/base/base_factory.rb, line 58 def parse_interactors(interactors) return if interactors.nil? interactors_array = [] interactors.each do |interactor| interactors_array.push(parse_interactor(interactor)) end interactors_array end
parse_properties(arguments)
click to toggle source
# File lib/ios_gen/base/base_factory.rb, line 40 def parse_properties(arguments) return if arguments.nil? arguments_properties = [] arguments.each do |property| arguments_properties.push(parse_property(property)) end arguments_properties end
parse_property(hash)
click to toggle source
# File lib/ios_gen/base/base_factory.rb, line 14 def parse_property(hash) Property.new(type: hash[TYPE_KEY], name: hash[NAME_KEY]) end
parse_view_controller(hash)
click to toggle source
# File lib/ios_gen/base/base_factory.rb, line 67 def parse_view_controller(hash) ViewController.new(name: hash[NAME_KEY], description: hash[DESCRIPTION_KEY]) end
parse_view_model(hash)
click to toggle source
# File lib/ios_gen/base/base_factory.rb, line 32 def parse_view_model(hash) ViewModel.new(description: hash[DESCRIPTION_KEY], name: hash[NAME_KEY], properties: parse_properties(hash[PROPERTIES_KEY]), actions: parse_actions(hash[ACTIONS_KEY]), interactors: parse_interactors(hash[INTERACTORS_KEY])) end