Sha256: d4ec7131c3cd87c08fa25019b151ff3a7aaba04d83125b5709ccad670e08a803

Contents?: true

Size: 325 Bytes

Versions: 13

Compression:

Stored size: 325 Bytes

Contents

format :html do
  def editor
    :text_field
  end
end

event :validate_number, :validate 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

13 entries across 13 versions & 1 rubygems

Version Path
card-1.93.7 mod/standard/set/type/number.rb
card-1.93.6 mod/standard/set/type/number.rb
card-1.93.5 mod/standard/set/type/number.rb
card-1.93.4 mod/standard/set/type/number.rb
card-1.93.3 mod/standard/set/type/number.rb
card-1.93.2 mod/standard/set/type/number.rb
card-1.93.1 mod/standard/set/type/number.rb
card-1.93.0 mod/standard/set/type/number.rb
card-1.92.2 mod/standard/set/type/number.rb
card-1.92.1 mod/standard/set/type/number.rb
card-1.92 mod/standard/set/type/number.rb
card-1.91 mod/standard/set/type/number.rb
card-1.21.0 mod/standard/set/type/number.rb