str2duck 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7da6d90a40042f4fbf8eb7ee19e1511bc87d0a8
4
- data.tar.gz: 79aaa4ba8fc30ccb12939360379c8cd2e0c7efe8
3
+ metadata.gz: b4425555775cd4480163150346432cad485303aa
4
+ data.tar.gz: f5ea181be5fe5dfcc5447d9b5afb800f58a9eafc
5
5
  SHA512:
6
- metadata.gz: 817f2c7e68c6b003505eb9ee45213ff9f76ca6f7e3c2e0f7fea604006901831e4d4662fd2b9150480789f0667e967578e768200a177f207f7480a73128e51794
7
- data.tar.gz: 0064c0937546a4300b83973f253ea6c1394f3c08cf4cdffa1e5135aecad7a59b4b2fc61ee0ff29395b7af5dc8f87b45f44061d57c324fd96c264f5747d458e21
6
+ metadata.gz: 49d18a74d0b21f305ebef57448d16e39eb75b6559f7967292c2cc1dc8aa8c45301d84ebfb437a1ae99ca4f3240c9f52c042def6e36dbbbbd48db56585697331e
7
+ data.tar.gz: a1af2ac332daa6e88dbb2d018d847d323e33bbce9345761caa3141c9e94593417ac5a1375f23bacf2a5add2892731a61d7426f4055db7a1d4f90b009709baf96
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/Gemfile.lock CHANGED
@@ -1,15 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- str2duck (0.0.1)
5
- active_support
4
+ str2duck (1.4.0)
6
5
 
7
6
  GEM
8
7
  remote: http://rubygems.org/
9
8
  specs:
10
- active_support (3.0.0)
11
- activesupport (= 3.0.0)
12
- activesupport (3.0.0)
13
9
 
14
10
  PLATFORMS
15
11
  ruby
data/README.md CHANGED
@@ -29,12 +29,12 @@ Possible bug source, not yet been tested is the american time format.
29
29
  Str2Duck.parse("123.123") #> Float obj
30
30
  ```
31
31
 
32
- it is possible ot extend the Duck flexibility be require the Active Supports time extension,
32
+ it is possible ot extend the Duck flexibility be installing Active Supports for it's time extension,
33
33
 
34
- simple like that:
34
+ simple like this in Gemfile:
35
35
 
36
36
  ```ruby
37
- require File.join 'active_support','time'
37
+ gem 'activesupport'
38
38
  ```
39
39
 
40
40
  This will give you even more flexibility in terms of use :)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0
1
+ 1.5.0
data/examples/sample.rb CHANGED
@@ -20,8 +20,6 @@ end
20
20
 
21
21
  begin
22
22
 
23
- require File.join 'active_support','time'
24
-
25
23
  puts "But if you load the Active support gem like when you do anyway in Rails,",
26
24
  "-> the parser will be more flexible in the time formats"
27
25
 
@@ -1,9 +1,17 @@
1
1
  #encoding: UTF-8
2
2
  module Str2Duck
3
3
 
4
+ def self.activesupport
5
+ require File.join 'active_support','time'
6
+ rescue LoadError
7
+ return false
8
+ end
9
+
4
10
  def self.parse str
5
11
  raise(ArgumentError,"invalid input, must be string like") unless str.class <= String
6
12
 
13
+ @@activesupport ||= activesupport
14
+
7
15
  var= nil
8
16
  [ :datetime, :date, :time, :true, :false, :float, :integer, :json, :yaml ].each do |method_name|
9
17
  if ::Str2Duck::Config.__send__(method_name)
data/str2duck.gemspec CHANGED
@@ -1,7 +1,5 @@
1
1
  # coding: utf-8
2
2
 
3
- require File.expand_path(File.join(File.dirname(__FILE__),"files.rb"))
4
-
5
3
  ### Specification for the new Gem
6
4
  Gem::Specification.new do |spec|
7
5
 
@@ -14,7 +12,7 @@ Gem::Specification.new do |spec|
14
12
  spec.homepage = "https://github.com/adamluzsi/str2duck"
15
13
  spec.license = "MIT"
16
14
 
17
- spec.files = Str2Duck.class_variable_get("@@spec_files")
15
+ spec.files = `git ls-files`.split($/)
18
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
18
  spec.require_paths = ["lib"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: str2duck
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Luzsi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-25 00:00:00.000000000 Z
11
+ date: 2014-05-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: " Parse string into obj "
14
14
  email:
@@ -17,6 +17,7 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - ".gitignore"
20
21
  - Gemfile
21
22
  - Gemfile.lock
22
23
  - LICENSE
@@ -25,7 +26,6 @@ files:
25
26
  - VERSION
26
27
  - examples/sample.rb
27
28
  - examples/test.rb
28
- - files.rb
29
29
  - lib/str2duck.rb
30
30
  - lib/str2duck/config.rb
31
31
  - lib/str2duck/format.rb
data/files.rb DELETED
@@ -1,23 +0,0 @@
1
- ### Get Files from dir
2
- begin
3
-
4
- module Str2Duck
5
- @@spec_files = []
6
- end
7
-
8
- Dir[File.expand_path(File.join(File.dirname(__FILE__),"**","*"))].sort.uniq.each do |one_file_name|
9
- one_file_name = File.expand_path one_file_name
10
- file_name = one_file_name[(File.expand_path(File.dirname(__FILE__)).to_s.length+1)..(one_file_name.length-1)]
11
-
12
- if !one_file_name.include?("pkg")
13
- if !File.directory? file_name
14
-
15
- Str2Duck.class_variable_get("@@spec_files").push file_name
16
- STDOUT.puts file_name if $DEBUG
17
-
18
- end
19
- end
20
-
21
- end
22
-
23
- end