santas_little_helper 0.0.2
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.
- data/lib/santas_little_helper.rb +43 -0
- metadata +49 -0
@@ -0,0 +1,43 @@
|
|
1
|
+
# SantasLittleHelper
|
2
|
+
|
3
|
+
# SYSTEM WIDE
|
4
|
+
|
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
|
+
|
7
|
+
# Works on Windows XP, 2003, 7 running Ruby 1.8.6 & 1.8.7 installed from RubyInstaller
|
8
|
+
def windows?
|
9
|
+
# Can't match for just 'win' cause it will match darwin as well.
|
10
|
+
(/win32|mswin|mingw/).match(RUBY_PLATFORM) ? true : false
|
11
|
+
end
|
12
|
+
|
13
|
+
# Works on Debian Sarge & Lenny and Ubuntu 9.10 running REE 1.8.7, don't have anything else to test on.
|
14
|
+
def linux?
|
15
|
+
(/linux/).match(RUBY_PLATFORM) ? true : false
|
16
|
+
end
|
17
|
+
|
18
|
+
# Works on my MacBook Pro OS 10.6 running Ruby 1.8.7 and rvm version of 1.9.1 , don't have anything else to test on,
|
19
|
+
def mac?
|
20
|
+
(/darwin/).match(RUBY_PLATFORM) ? true : false
|
21
|
+
end
|
22
|
+
|
23
|
+
# When something is True / False and I can to_s it, why can't I to_i it?
|
24
|
+
# There is actually a good theoretical reason, but in real world it really helps if you can output true or false as an int when you are sending soap request to a client, whose api requires it as 1 or 0, or humanize to "yes" & "no" form.
|
25
|
+
# For an alternative solution check out http://www.ruby-forum.com/topic/206789#new
|
26
|
+
|
27
|
+
class TrueClass
|
28
|
+
def to_i
|
29
|
+
1
|
30
|
+
end
|
31
|
+
def to_h
|
32
|
+
'yes'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
class FalseClass
|
36
|
+
def to_i
|
37
|
+
0
|
38
|
+
end
|
39
|
+
def to_h
|
40
|
+
'no'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
metadata
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: santas_little_helper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Nick Gorbikoff
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-11-15 00:00:00.000000000Z
|
13
|
+
dependencies: []
|
14
|
+
description: ! 'This is a collection of useful little snippets that I used through
|
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
|
+
'
|
19
|
+
email: nick.gorbikoff@gmail.com
|
20
|
+
executables: []
|
21
|
+
extensions: []
|
22
|
+
extra_rdoc_files: []
|
23
|
+
files:
|
24
|
+
- lib/santas_little_helper.rb
|
25
|
+
homepage: http://rubygems.org/gems/santas_little_helper
|
26
|
+
licenses: []
|
27
|
+
post_install_message:
|
28
|
+
rdoc_options: []
|
29
|
+
require_paths:
|
30
|
+
- lib
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
+
none: false
|
33
|
+
requirements:
|
34
|
+
- - ! '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ! '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
requirements: []
|
44
|
+
rubyforge_project:
|
45
|
+
rubygems_version: 1.7.2
|
46
|
+
signing_key:
|
47
|
+
specification_version: 3
|
48
|
+
summary: It's dumb just like the famous dog, but it may surprise you.
|
49
|
+
test_files: []
|