Class: Bike::Textarea

Inherits:
Field
  • Object
show all
Defined in:
lib/scalar/textarea.rb

Overview

Author

Akira FUNAI

Copyright

Copyright © 2009 Akira FUNAI

Direct Known Subclasses

Pre, Wiki

Defined Under Namespace

Classes: Pre, Wiki

Constant Summary

Constants inherited from Field

Field::DEFAULT_META

Instance Attribute Summary

Attributes inherited from Field

#action, #result

Instance Method Summary collapse

Methods inherited from Field

#[], #[]=, #commit, #create, #default_action, #delete, #empty?, #find_ancestor, #get, h, #initialize, #inspect, instance, #item, #load, #load_default, #meta_admins, #meta_client, #meta_folder, #meta_full_name, #meta_group, #meta_name, #meta_owner, #meta_owners, #meta_roles, #meta_sd, #meta_short_name, #pending?, #permit?, #post, #update, #val, #valid?, #workflow

Methods included from I18n

_, bindtextdomain, domain, domain=, find_msg, lang, lang=, merge_msg!, msg, n_, parse_msg, po_dir, po_dir=

Constructor Details

This class inherits a constructor from Bike::Field

Instance Method Details

#errorsObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/scalar/textarea.rb', line 8

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