Sha256: 81cf9c6eba6e1c3ddf52165fba67fa2141f73b705ef3f3613e47e5644bbae6e4

Contents?: true

Size: 873 Bytes

Versions: 4

Compression:

Stored size: 873 Bytes

Contents

require "str2duck"

[
  "2011-03-12",
  "2007-07-20 18:59:27 +0200",
  "2010-10-30 18:02:56 +0200",
  "2012-09-12T14:49:50+02:00",
  "123",
  "asd",
  "123.432",
  "true",
  "false",
  "some string data",
  "{\"hello\":\"json\"}",
  "--- hello\n..." ,
  "hello: yaml"
].each do |object|
  puts object.duck,object.duck.class,""
end

begin

  puts "But if you load the Active support gem like when you do anyway in Rails,",
       "-> the parser will be more flexible in the time formats"

  [
      "2011-03-12",
      "2007-07-20 18:59:27 +0100",
      "2010-10-30 18:02:56 +0200",
      "2012-09-12T14:49:50+02:00",
      "123",
      "asd",
      "123.432",
      "true",
      "false",
      "some string data",
      "Sun, 28 Aug 2005",
      "Fri, 25 Jan 2013 20:02:15 +0100"

  ].each do |object|
    puts object.duck,object.duck.class,""
  end

rescue LoadError
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
str2duck-1.7.1 examples/sample.rb
str2duck-1.7.0 examples/sample.rb
str2duck-1.6.0 examples/sample.rb
str2duck-1.5.0 examples/sample.rb