Sha256: c499f02dad8975dd7e1461539550beae11253c01b6f2e1d0458c7ab7b4aab1ba

Contents?: true

Size: 877 Bytes

Versions: 34

Compression:

Stored size: 877 Bytes

Contents

module JsonVoorhees
	class EngineCreateSerializerGenerator < Rails::Generators::Base
	  source_root File.expand_path('../templates', __FILE__)
	  argument :module_name, :type => :string
	  argument :resource_name, :type => :string
	  argument :api_version, :type => :string, :default => "1"
	  argument :attributes, type: :array, default: [], banner: "field:type field:type"

	  def sprint
	  	template "serializer.rb.erb", "app/serializers/#{module_name.underscore}/v#{api_version}/#{resource_singular}_serializer.rb"
	  end

	  private

	  def resource_singular
	  	resource_name.underscore.singularize
	  end

	  def resource_plural
	  	resource_name.underscore.pluralize
	  end

	  def resource_camel
	  	resource_name.camelize.singularize
	  end

	  def module_camel
	  	module_name.camelize
	  end

	  def module_snake
	  	module_name.underscore.downcase
	  end

	end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
json_voorhees-0.4.9 lib/generators/json_voorhees/engine_create_serializer/engine_create_serializer_generator.rb
json_voorhees-0.4.8 lib/generators/json_voorhees/engine_create_serializer/engine_create_serializer_generator.rb
json_voorhees-0.4.7 lib/generators/json_voorhees/engine_create_serializer/engine_create_serializer_generator.rb
json_voorhees-0.4.6 lib/generators/json_voorhees/engine_create_serializer/engine_create_serializer_generator.rb
json_voorhees-0.4.5 lib/generators/json_voorhees/engine_create_serializer/engine_create_serializer_generator.rb
json_voorhees-0.4.4 lib/generators/json_voorhees/engine_create_serializer/engine_create_serializer_generator.rb
json_voorhees-0.4.3 lib/generators/json_voorhees/engine_create_serializer/engine_create_serializer_generator.rb
json_voorhees-0.4.2 lib/generators/json_voorhees/engine_create_serializer/engine_create_serializer_generator.rb
json_voorhees-0.4.1 lib/generators/json_voorhees/engine_create_serializer/engine_create_serializer_generator.rb
json_voorhees-0.4.0 lib/generators/json_voorhees/engine_create_serializer/engine_create_serializer_generator.rb
json_voorhees-0.3.9 lib/generators/json_voorhees/engine_create_serializer/engine_create_serializer_generator.rb
json_voorhees-0.3.6 lib/generators/json_voorhees/engine_create_serializer/engine_create_serializer_generator.rb
json_voorhees-0.3.5 lib/generators/json_voorhees/engine_create_serializer/engine_create_serializer_generator.rb
json_voorhees-0.3.0 lib/generators/json_voorhees/engine_create_serializer/engine_create_serializer_generator.rb