Sha256: a4989012a863467935cddc46c2976ecf433fbf55db87f1912bb5b0a7aa898936

Contents?: true

Size: 463 Bytes

Versions: 33

Compression:

Stored size: 463 Bytes

Contents

module PushType
  class StructureGenerator < Rails::Generators::NamedBase
    source_root File.expand_path('../templates', __FILE__)
    argument :attributes, type: :array, default: [], banner: "field:type field:type"

    def create_model
      template 'structure.rb', "app/models/#{ file_name }.rb"
    end

    hook_for :test_framework, as: :model

    protected

    def attribute_as_field(att)
      "field :#{ att.name }, :#{ att.type }"
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
push_type_core-0.12.1 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.12.0 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.12.0.beta.1 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.11.2 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.11.1 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.11.0.beta.2 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.11.0.beta.1 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.10.4 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.10.3 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.10.2 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.10.1 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.10.0 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.10.0.beta.5 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.10.0.beta.3 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.9.5 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.9.3 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.9.2 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.9.1 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.9.0 lib/generators/push_type/structure/structure_generator.rb
push_type_core-0.9.0.beta.4 lib/generators/push_type/structure/structure_generator.rb