Sha256: 4d237455e028c9f61cf6adb7618de803724f32ef4a11fdc98e75ef9a118fb973

Contents?: true

Size: 923 Bytes

Versions: 1

Compression:

Stored size: 923 Bytes

Contents

$LOAD_PATH.unshift(File.join(__dir__,'..','lib'))
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

1 entries across 1 versions & 1 rubygems

Version Path
str2duck-2.0.0 examples/sample.rb