<commit_before># encoding: UTF-8

# Author::    <NAME>
# Copyright:: Copyright (c) 2009 <NAME>

class Sofa::Textarea < Sofa::Field

	private

	def _g_create(arg)
		<<_html.chomp
<textarea name="#{my[:short_name]}" cols="#{my[:width]}" rows="#{my[:height]}" class="#{_g_class arg}">#{val}</textarea>
_html
	end
	alias :_g_update :_g_create

	def val_cast(v)
		v.to_s
	end

end


class Sofa::Textarea::Pre < Sofa::Textarea

	def _g_default(arg)
		'<pre>' + Rack::Utils.escape_html(val.to_s) + '</pre>'
	end

end
<commit_msg>Textarea#errors<commit_after># encoding: UTF-8

# Author::    <NAME>
# Copyright:: Copyright (c) 2009 <NAME>

class Sofa::Textarea < Sofa::Field

	def errors
		if (my[:max].to_i > 0) && (val.size > my[:max])
			['too long']
		elsif (my[:min].to_i == 1) && val.empty?
			['mandatory']
		elsif (my[:min].to_i > 0) && (val.size < my[:min])
			['too short']
		else
			[]
		end
	end

	private

	def _g_create(arg)
		<<_html.chomp
<textarea name="#{my[:short_name]}" cols="#{my[:width]}" rows="#{my[:height]}" class="#{_g_class arg}">#{val}</textarea>
_html
	end
	alias :_g_update :_g_create

	def val_cast(v)
		v.to_s
	end

end


class Sofa::Textarea::Pre < Sofa::Textarea

	def _g_default(arg)
		'<pre>' + Rack::Utils.escape_html(val.to_s) + '</pre>'
	end

end

{'fraction_non_alphanumeric': 0.20250195465207194, 'fraction_numerical': 0.010164190774042221, 'mean_word_length': 4.541125541125541, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '736367', 'n_tokens_mistral': 582, 'n_tokens_neox': 536, 'n_words': 110}