santas_little_helper 0.0.7 → 0.0.10
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 +7 -0
- data/lib/santas_little_helper.rb +16 -10
- metadata +10 -15
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c3a78a7ba1fc653765b2e4885f6d1ec0f0354ca2
|
4
|
+
data.tar.gz: 19424e3d6f5c21cc2ea035ed4ccbda7db6a59737
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f0f68e62783c94d6339f1a368323ad135cebd247ad07a7f2b72b18fa46ab3b8f82912abad10cbdb6e504c2965d0b55801e6d1eb15afdbef413981665e912122d
|
7
|
+
data.tar.gz: 83c0858fe74816861090774a1d9d3a73035c3226aa15db3345d91c35de93dffac2b273ce324a87da957b92d59b88c13f4706f28b3a0ee26156a13c44dc03d371
|
data/lib/santas_little_helper.rb
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
|
5
5
|
# Determines if Windows platform or not. This will match all windows systems known to me (author). If you find otherwise let me know please.
|
6
6
|
# There is one pitful - if you are running on jruby - it returns "java", as supposedly it it is platform independent. So if you are checking
|
7
|
-
# for os and running jruby - it will return false, since it won't match. You should use it in conjunction with jruby? & mri? if you are
|
7
|
+
# for os and running jruby - it will return false, since it won't match. You should use it in conjunction with jruby? & mri? if you are
|
8
8
|
# unticipating that to be a problem. I'm not defining java? as it may cause problems with jruby potentially.
|
9
|
-
# Not really worried about maglev & rubinius & ironruby right now - as they are not really mutiplatform, not as widespread and I can't test for
|
9
|
+
# Not really worried about maglev & rubinius & ironruby right now - as they are not really mutiplatform, not as widespread and I can't test for
|
10
10
|
# them right now.
|
11
11
|
|
12
12
|
# Works on Windows XP, 2003, 7 running Ruby 1.8.6 & 1.8.7 installed from RubyInstaller
|
@@ -32,14 +32,14 @@ end
|
|
32
32
|
# Works for jruby 1.7.0.rc1 and jruby 1.6.3 on windows (7 & xp)
|
33
33
|
def jruby?
|
34
34
|
(/java/).match(RUBY_PLATFORM) ? true : false
|
35
|
-
end
|
35
|
+
end
|
36
36
|
|
37
37
|
def mri?
|
38
38
|
(/i386|x86_64|x86/).match(RUBY_PLATFORM) ? true : false
|
39
39
|
end
|
40
40
|
|
41
41
|
|
42
|
-
# In case ruby ever reaches version 19 :-) or some 2.19 :-) only matching 1.9 at the begining of the line
|
42
|
+
# In case ruby ever reaches version 19 :-) or some 2.19 :-) only matching 1.9 at the begining of the line
|
43
43
|
def version_1_9?
|
44
44
|
(/^1.9./).match(RUBY_VERSION) ? true : false
|
45
45
|
end
|
@@ -58,16 +58,16 @@ class TrueClass
|
|
58
58
|
def to_i
|
59
59
|
1
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
# Humanize. to_s returns "true"
|
63
63
|
def to_h
|
64
64
|
"yes"
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
# Really I need to spell it out to you?
|
68
68
|
def to_teenager
|
69
69
|
"Yeah, yeah. Here you go. Did you get what you came for? Now disappear."
|
70
|
-
end
|
70
|
+
end
|
71
71
|
end
|
72
72
|
class FalseClass
|
73
73
|
# Rails conventions for boolean / tinyint
|
@@ -81,7 +81,7 @@ class FalseClass
|
|
81
81
|
# Little obnoxious teenager.
|
82
82
|
def to_teenager
|
83
83
|
"Can't you leave me alone? I don't have anything!"
|
84
|
-
end
|
84
|
+
end
|
85
85
|
end
|
86
86
|
class NilClass
|
87
87
|
# Since in if/else nil is interpreted as false, return same as false.
|
@@ -93,9 +93,15 @@ class NilClass
|
|
93
93
|
def to_h
|
94
94
|
""
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
# A very rude teenager nihilist.
|
98
98
|
def to_teenager
|
99
99
|
"Zip! Nada! Babkis! Nothing to see here! Get out of my room!"
|
100
|
-
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
class String
|
103
|
+
# See http://stackoverflow.com/questions/8119970/string-true-and-false-to-boolean
|
104
|
+
def to_boolean
|
105
|
+
!!(self =~ /^(true|t|yes|y|1)$/i)
|
106
|
+
end
|
101
107
|
end
|
metadata
CHANGED
@@ -1,50 +1,45 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: santas_little_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.10
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Nick Gorbikoff
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-05-23 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
|
-
description:
|
15
|
-
out various projects. If there is something you would like to add either check it
|
16
|
-
out and modify it the way you want or let me know and I might add it here.
|
17
|
-
|
18
|
-
'
|
13
|
+
description: |
|
14
|
+
This is a collection of useful little snippets that I used through out various projects. If there is something you would like to add either check it out and modify it the way you want or let me know and I might add it here.
|
19
15
|
email: nick.gorbikoff@gmail.com
|
20
16
|
executables: []
|
21
17
|
extensions: []
|
22
18
|
extra_rdoc_files: []
|
23
19
|
files:
|
24
20
|
- lib/santas_little_helper.rb
|
25
|
-
homepage:
|
21
|
+
homepage: https://github.com/konung/santas_little_helper
|
26
22
|
licenses: []
|
23
|
+
metadata: {}
|
27
24
|
post_install_message:
|
28
25
|
rdoc_options: []
|
29
26
|
require_paths:
|
30
27
|
- lib
|
31
28
|
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
-
none: false
|
33
29
|
requirements:
|
34
|
-
- -
|
30
|
+
- - '>='
|
35
31
|
- !ruby/object:Gem::Version
|
36
32
|
version: '0'
|
37
33
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
34
|
requirements:
|
40
|
-
- -
|
35
|
+
- - '>='
|
41
36
|
- !ruby/object:Gem::Version
|
42
37
|
version: '0'
|
43
38
|
requirements: []
|
44
39
|
rubyforge_project:
|
45
|
-
rubygems_version:
|
40
|
+
rubygems_version: 2.0.0
|
46
41
|
signing_key:
|
47
|
-
specification_version:
|
42
|
+
specification_version: 4
|
48
43
|
summary: It's dumb just like the famous dog, but it may surprise you. It modifies
|
49
44
|
core classes, use at your own risk!
|
50
45
|
test_files: []
|