Class: Jenson

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(generator, class_name, fields) ⇒ Jenson

Returns a new instance of Jenson.



11
12
13
14
15
# File 'lib/jenson.rb', line 11

def initialize(generator, class_name, fields)
  fields = fields.map { |f| {name: f.split(':')[0], type: f.split(':')[-1]}  }
  @model = ModelFactory.create_model(generator, class_name, fields)
  @generator = GeneratorFactory.create_generator(generator) 
end

Instance Attribute Details

#generatorObject

Returns the value of attribute generator.



9
10
11
# File 'lib/jenson.rb', line 9

def generator
  @generator
end

#modelObject

Returns the value of attribute model.



8
9
10
# File 'lib/jenson.rb', line 8

def model
  @model
end

Instance Method Details

#generateObject



17
18
19
20
# File 'lib/jenson.rb', line 17

def generate()
  puts "Model -> #{@model.class}" 
  puts "Factory built -> #{@generator.class}"
end