HumanName
Never write def full_name again!
Installation
Add this line to your application's Gemfile:
gem 'human_name'
And then execute:
$ bundle
Or install it yourself as:
$ gem install human_name
Usage
class Person
include HumanName::Methods.new(:first_name, :last_name)
attr_reader :first_name, :last_name
def initialize(first_name, last_name)
@first_name, @last_name = first_name, last_name
end
end
person = Person.new('John', 'Doe')
person.human_name # => #<HumanName:0x007fe590825b68 @first_name="John", @last_name="Doe">
person.full_name # => 'John Doe'
person.name_initials # => 'J. D.'
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request