Class: Pliny::Commands::Generator::Serializer

Inherits:
Base
  • Object
show all
Defined in:
lib/pliny/commands/generator/serializer.rb

Instance Attribute Summary

Attributes inherited from Base

#name, #options, #stream

Instance Method Summary collapse

Methods inherited from Base

#display, #field_name, #initialize, #plural_class_name, #pluralized_file_name, #render_template, #singular_class_name, #table_name, #write_file, #write_template

Constructor Details

This class inherits a constructor from Pliny::Commands::Generator::Base

Instance Method Details

#createObject



6
7
8
9
10
11
# File 'lib/pliny/commands/generator/serializer.rb', line 6

def create
  serializer = "./lib/serializers/#{field_name}.rb"
  write_template('serializer.erb', serializer,
                  singular_class_name: singular_class_name)
  display "created serializer file #{serializer}"
end

#create_testObject



13
14
15
16
17
18
# File 'lib/pliny/commands/generator/serializer.rb', line 13

def create_test
  test = "./spec/serializers/#{field_name}_spec.rb"
  write_template('serializer_test.erb', test,
                  singular_class_name: singular_class_name)
  display "created test #{test}"
end