Class: ActionBlocks::Generators::TypeGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
ActionBlocks::GeneratorHelper, Rails::Generators::ResourceHelpers
Defined in:
lib/generators/active_blocks/type/type_generator.rb,
lib/action_blocks/generators/action_blocks/type/type_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fieldsObject

Returns the value of attribute fields.



7
8
9
# File 'lib/generators/active_blocks/type/type_generator.rb', line 7

def fields
  @fields
end

#sub_blocksObject

Returns the value of attribute sub_blocks.



7
8
9
# File 'lib/generators/active_blocks/type/type_generator.rb', line 7

def sub_blocks
  @sub_blocks
end

Instance Method Details

#view_templatesObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/generators/active_blocks/type/type_generator.rb', line 15

def view_templates
  # @struct_methods = ask("Struct Methods: (e.g. title)").split()
  # @builder_methods = ask("Builder Methods: (e.g. string_field, float_field)").split()
  @fields = options[:fields]
  @builds = options[:builds]
  template "dsl.rb", "lib/action_blocks/#{variable}_builder.rb"
  template "controller.rb", "app/controllers/#{variable}_blocks_controller.rb"
  template "type.css", "client/src/ActionBlocks/#{class_name}/#{class_name}.css"
  template "type.js", "client/src/ActionBlocks/#{class_name}/#{class_name}.js"
end