duffy 0.2.2 → 0.2.3
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 +4 -4
- data/README.md +51 -34
- data/lib/duffy/date.rb +10 -0
- data/lib/duffy/string.rb +6 -0
- data/lib/duffy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96eeac69472d545eb850cd92b52896f386a82ee6
|
4
|
+
data.tar.gz: 1b2ff4d0e8628918f2cab3080da6b14da94579be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 374da46815f90ac5b63501bb74e89bf296fa69c46360c4c8a01f191879239fdc8823bd6fa91399fc8e727ab0b9223597574da84aedce87fec5203f6a75bde2b6
|
7
|
+
data.tar.gz: ab58ee610db03e93da864b2419f1cbb1aab9bb20482d62db51bc464322273241a06f9293a17ae7b6e938c3a846b723133a2d879339ca33146f295a814423ed00
|
data/README.md
CHANGED
@@ -15,69 +15,86 @@ gem 'duffy'
|
|
15
15
|
```
|
16
16
|
|
17
17
|
And then execute:
|
18
|
-
|
19
|
-
|
18
|
+
```shell
|
19
|
+
$ bundle
|
20
|
+
```
|
20
21
|
|
21
22
|
## Usage
|
22
23
|
|
23
24
|
String Patches:
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
25
|
+
|
26
|
+
Method | Example | Output
|
27
|
+
------------------|-----------------|-------
|
28
|
+
date! | "2014-07-16" | #< Date: 2015-07-16 >
|
29
|
+
md5 | "duffy" | "904bc6e21e4799ce276200117215b88b"
|
30
|
+
md5sum | "duffy" | "904bc6e21e4799ce276200117215b88b"
|
31
|
+
to_ssn | "123456789" | "123-45-6789"
|
32
|
+
to_numeric | "abc123" | "123"
|
33
|
+
to_alpha | "abc123" | "abc"
|
34
|
+
to_alpha_numeric | "abc#$%123" | "abc123
|
35
|
+
pretty_phone | "1234567890" | "(123) 456-7890"
|
36
|
+
pretty_committer | "bart" | "Bartholomew Simpson" (See config)
|
37
|
+
space2nbsp | "space out" | "space out" (requires rails)
|
38
|
+
nl2br | "space\nout" | "space<br/>out" (requires rails)
|
39
|
+
gender_human | "F" | "Female"
|
40
|
+
smart_titlecase | "this and that" | "This and That" (Note: Has config options. See lib/duffy.rb)
|
41
|
+
|
36
42
|
|
37
43
|
Date Patches:
|
38
|
-
|
39
|
-
|
40
|
-
|
44
|
+
|
45
|
+
Method | Example | Output
|
46
|
+
------------------|-----------------|-------
|
47
|
+
date! | Date.today | self
|
48
|
+
fiscal_year | Date.today | 2015 (See config to set your organization's fiscal year start.)
|
49
|
+
|
50
|
+
|
51
|
+
NilClass Patches:
|
52
|
+
|
53
|
+
Method | Example | Output
|
54
|
+
------------------|-----------------|-------
|
55
|
+
date! | nil | self (Exists so you can call .date! on Date, String or nil
|
56
|
+
|
41
57
|
|
42
58
|
Active Record Aliases:
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
59
|
+
|
60
|
+
Alias | Standard
|
61
|
+
------------------|---------
|
62
|
+
accepts | accepts_nested_attributes_for
|
63
|
+
habtm | has_and_belongs_to_many
|
47
64
|
|
48
65
|
|
49
66
|
Git Access:
|
50
67
|
This one is namespaced in case you use the 'git' gem. I found it to be overkill for what I wanted.
|
51
68
|
```ruby
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
69
|
+
Duffy::Git.log # => Produce tab separated listing of current git log.
|
70
|
+
Duffy::Git.count # => Count of git commits in current branch
|
71
|
+
Duffy::Git.email # => Local repo's git user.email or global if none.
|
72
|
+
Duffy::Git.branch # => Current git branch.
|
56
73
|
```
|
57
74
|
|
58
75
|
CPU Detection:
|
59
76
|
Linux and Mac only for now, each method returns 1 on unsupported hosts.
|
60
77
|
Example results for my dual core i5 with hyperthreading.
|
61
78
|
```ruby
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
79
|
+
Duffy::System.cpus # => 1
|
80
|
+
Duffy::System.cores # => 2
|
81
|
+
Duffy::System.threads # => 4
|
82
|
+
Duffy::System.sane_load # => 3
|
66
83
|
```
|
67
84
|
|
68
85
|
|
69
86
|
View Helpers:
|
70
87
|
This is a work in progress. I'm going to try to put all my generic helpers here.
|
71
88
|
```ruby
|
72
|
-
|
73
|
-
|
74
|
-
|
89
|
+
menu_tag
|
90
|
+
excel_icon
|
91
|
+
icon
|
75
92
|
```
|
76
93
|
|
77
94
|
CSS Reset & Print Styles: Very barebones CSS Reset / Sensible defaults and Print stylesheets.
|
78
95
|
```ruby
|
79
|
-
|
80
|
-
|
96
|
+
require duffy/reset
|
97
|
+
require duffy/print
|
81
98
|
```
|
82
99
|
|
83
100
|
## Contributing
|
data/lib/duffy/date.rb
CHANGED
data/lib/duffy/string.rb
CHANGED
data/lib/duffy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: duffy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Duffy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|