module ActiveLeonardo::Leosca::Locale

Protected Instance Methods

attributes_to_hints(attributes, file_name) click to toggle source
# File lib/generators/active_leonardo.rb, line 152
def attributes_to_hints(attributes, file_name)
  content = "#{CRLF}      #{file_name}:#{CRLF}"
  attributes.each do |attribute|
    attribute_name_for_desc = attribute.name.humanize.downcase
    case attribute.type
      when :integer, :decimal, :float
        content << "        #{attribute.name}: \"Fill the #{attribute_name_for_desc} with a#{"n" if attribute.type == :integer} #{attribute.type.to_s} number\"#{CRLF}"
      when :boolean
        content << "        #{attribute.name}: \"Select if this #{file_name} should be #{attribute_name_for_desc} or not\"#{CRLF}"
      when :string
        content << "        #{attribute.name}: \"Choose a good #{attribute_name_for_desc} for this #{file_name}\"#{CRLF}"
      when :text
        content << "        #{attribute.name}: \"Write something as #{attribute_name_for_desc}\"#{CRLF}"
      when :date, :datetime, :time, :timestamp
        content << "        #{attribute.name}: \"Choose a #{attribute.type.to_s} for #{attribute_name_for_desc}\"#{CRLF}"
      else
        content << "        #{attribute.name}: \"Choose the #{attribute_name_for_desc}\"#{CRLF}"
    end
  end
  content
end
attributes_to_list(attributes, file_name) click to toggle source
# File lib/generators/active_leonardo.rb, line 144
def attributes_to_list(attributes, file_name)
  content = "#{CRLF}      #{file_name}:#{CRLF}"
  attributes.each do |attribute|
    content << "        #{attribute.name}: \"#{attribute.name.humanize}\"#{CRLF}"
  end
  content
end