Method: Template::Spec#klippfile

Defined in:
lib/template/spec.rb

#klippfileObject



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/template/spec.rb', line 191

def klippfile
  kf = "create '#{self.class.expand_identifier(self.identifier)}' do |tokens|\n\n"
  @tokens.each do |name, token|
    unless token.hidden
      kf += "  # #{token.comment}\n" if token.comment
      kf += "  # #{token.validation_hint}\n" if token.validation_hint
      if token.type == :bool
        kf += "  tokens[:#{name}] = #{token.default_value ? 'true' : 'false'}\n"
      else
        kf += "  tokens[:#{name}] = \"#{token.default_value}\"\n"
      end
      kf += "\n"
    end
  end
  kf += "end"
end