Sha256: 52cd03bd7c8f08d1e5af4863bf0639629892d7b594f478bc2532268cc42b35d5

Contents?: true

Size: 390 Bytes

Versions: 7

Compression:

Stored size: 390 Bytes

Contents

# -*- encoding : utf-8 -*-

view :editor do |args|
  form.text_field :content, :class=>'card-content'
end

event :validate_number, :after=>:approve do
  errors.add :content, "'#{content}' is not numeric" unless valid_number?( content )
end

def valid_number?( string )
  valid = true
  begin
    Kernel.Float( string )
  rescue ArgumentError, TypeError
    valid = false
  end
  valid
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wagn-1.12.13 mods/standard/sets/type/number.rb
wagn-1.12.12 mods/standard/sets/type/number.rb
wagn-1.12.11 mods/standard/sets/type/number.rb
wagn-1.12.10 mods/standard/sets/type/number.rb
wagn-1.12.9 mods/standard/sets/type/number.rb
wagn-1.12.8 mods/standard/sets/type/number.rb
wagn-1.12.7 mods/standard/sets/type/number.rb