human_name 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8bc2d175321c5d35c18a983b4141cbd9a9cd250
4
- data.tar.gz: 0f079e5ee1799de02940fe068b745140e0f175b7
3
+ metadata.gz: c90a1f74e4e3eaaa1a640cae0fbe243b6638b977
4
+ data.tar.gz: 49da3f75a9d6d6d8e99efea946772d52103f9d4a
5
5
  SHA512:
6
- metadata.gz: 9feee94f70c46381738d0e4567b89c79f61c1d9963a5f529f3f9431fb446c96414fa701bf1c810f299075e4eca619707c349fe9ea974252651034688bcc2a09c
7
- data.tar.gz: 1ce31adf416dc2b70c58391d7e039b56737c4b3cf399a483548f189394ba77ec6e53e675712fa369f6e6c5ae3546731e1e99d76a0d733ec1696060e827d50be0
6
+ metadata.gz: 4fd1d30a056cab464290f0846fa4ac829ac346bd9a3481def56061f66ae120de02841785128ac0bc6b8bc3a380eda943a56c5fb45e069dba929e6b5c06c361f1
7
+ data.tar.gz: 9850cf384afb508ab93c576ac011f4be12236360a3284a19a58676a0b25591edf36025f14c254c81395807d2615ac75de698de0e16472e0ccf719d7018afc4ac
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.0
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # HumanName
2
2
 
3
+ [![Gem
4
+ Version](https://badge.fury.io/rb/human_name.png)](http://badge.fury.io/rb/human_name)
5
+ [![Build
6
+ Status](https://travis-ci.org/mcls/human_name.png?branch=master)](https://travis-ci.org/mcls/human_name)
7
+
3
8
  Never write `def full_name` again!
4
9
 
5
10
  ## Installation
@@ -19,8 +24,12 @@ Or install it yourself as:
19
24
  ## Usage
20
25
 
21
26
  ```ruby
27
+ require "rubygems"
28
+ require "human_name"
29
+
22
30
  class Person
23
- include HumanName::Methods.new(:first_name, :last_name)
31
+ # Assumes :first_name and :last_name methods exist
32
+ include HumanName::Defaults
24
33
 
25
34
  attr_reader :first_name, :last_name
26
35
 
@@ -29,10 +38,30 @@ class Person
29
38
  end
30
39
  end
31
40
 
32
- person = Person.new('John', 'Doe')
33
- person.human_name # => #<HumanName:0x007fe590825b68 @first_name="John", @last_name="Doe">
34
- person.full_name # => 'John Doe'
35
- person.name_initials # => 'J. D.'
41
+ person = Person.new("John", "Doe")
42
+ p person.human_name # => #<HumanName:0x007fe590825b68 @first_name="John", @last_name="Doe">
43
+ p person.full_name # => "John Doe"
44
+ p person.name_initials # => "J. D."
45
+
46
+ class P3rs0n
47
+ # You can also use custom methods
48
+ include HumanName::Methods.new(:f_n4m3, :l_n4m3)
49
+
50
+ def f_n4m3
51
+ "John"
52
+ end
53
+
54
+ def l_n4m3
55
+ "Doe"
56
+ end
57
+ end
58
+
59
+ person = P3rs0n.new
60
+ p person.human_name # => #<HumanName:0x007fe590825b68 @first_name="John", @last_name="Doe">
61
+ p person.full_name # => "John Doe"
62
+ p person.name_initials # => "J. D."
63
+ p person.human_name.first_name # => "John"
64
+ p person.human_name.last_name # => "Doe"
36
65
  ```
37
66
 
38
67
  ## Contributing
@@ -0,0 +1,3 @@
1
+ class HumanName
2
+ Defaults = HumanName::Methods.new
3
+ end
@@ -1,3 +1,3 @@
1
1
  class HumanName
2
- VERSION = "0.0.1".freeze
2
+ VERSION = "0.1.0".freeze
3
3
  end
data/lib/human_name.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "forwardable"
2
2
  require "human_name/version"
3
3
  require "human_name/methods"
4
+ require "human_name/defaults"
4
5
 
5
6
  class HumanName
6
7
  attr_reader :first_name, :last_name
@@ -0,0 +1 @@
1
+ require 'spec_helper'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: human_name
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maarten Claes
@@ -75,14 +75,17 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - .gitignore
77
77
  - .rspec
78
+ - .travis.yml
78
79
  - Gemfile
79
80
  - LICENSE.txt
80
81
  - README.md
81
82
  - Rakefile
82
83
  - human_name.gemspec
83
84
  - lib/human_name.rb
85
+ - lib/human_name/defaults.rb
84
86
  - lib/human_name/methods.rb
85
87
  - lib/human_name/version.rb
88
+ - spec/human_name/defaults.rb
86
89
  - spec/human_name/methods_spec.rb
87
90
  - spec/human_name_spec.rb
88
91
  - spec/spec_helper.rb
@@ -111,6 +114,7 @@ signing_key:
111
114
  specification_version: 4
112
115
  summary: If I have to write 'def full_name' one more time...
113
116
  test_files:
117
+ - spec/human_name/defaults.rb
114
118
  - spec/human_name/methods_spec.rb
115
119
  - spec/human_name_spec.rb
116
120
  - spec/spec_helper.rb