class BottledServiceGenerator

Public Instance Methods

generate_bottled_service() click to toggle source
# File lib/generators/bottled_service/bottled_service_generator.rb, line 6
  def generate_bottled_service
    puts "Generating Bottled Service: #{name}"
    create_file "app/services/#{file_name}.rb", <<-File
class #{class_name} < BottledService

  #{ "".tap do |str|
      attributes.each do |attribute|
        puts "injecting attribute: #{attribute.name}"
        if attribute.type.present?
          str << "att :#{attribute.name}, #{attribute.type}
  "
        else
          str << "att :#{attribute.name}
  "
        end
      end
    end
}

  def call
    # Do something...
    yield if block_given?
  end

end
    File
  end