class SixSaferpay::Generators::Model
Attributes
attributes[RW]
file_name[RW]
Public Class Methods
source_root()
click to toggle source
# File lib/generators/models.rb, line 15 def self.source_root File.dirname(__FILE__) end
Public Instance Methods
create_attributes_array()
click to toggle source
# File lib/generators/models.rb, line 23 def create_attributes_array @attributes = [] if method_attributes method_attributes.each do |key, value| split = value.split(':') name = key.underscore type = split.first if split.length == 2 mandatory = split.last else mandatory = false end attribute = Attribute.new(name, type, mandatory) @attributes << attribute end end end
create_fabric_file()
click to toggle source
# File lib/generators/models.rb, line 52 def create_fabric_file template('templates/fabric.erb', "spec/fabrics/six_saferpay/models/#{@file_name.pluralize}.rb") end
create_model_file()
click to toggle source
# File lib/generators/models.rb, line 44 def create_model_file template('templates/model.erb', "lib/six_saferpay/models/#{@file_name}.rb") end
create_test_file()
click to toggle source
# File lib/generators/models.rb, line 48 def create_test_file template('templates/spec.erb', "spec/six_saferpay/models/#{@file_name}_spec.rb") end