Skip to content

Commit

Permalink
readme fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
voytee committed Nov 15, 2012
1 parent ecc89f5 commit 65d8ff9
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ Rubinius 1.2.2.

activepesel is available as a gem. In your Gemfile add

```ruby
```
gem 'activepesel'
```

#In your model:

```ruby
```
class User < ActiveRecord::Base
attr_accessible :dads_pesel, :mums_pesel
Expand All @@ -31,17 +31,28 @@ end

# Activepesel::PersonalData object

When using ```rubyattr_pesel :name_of_attr``` in your model you will get new instance method available: ```rubyname_of_attr_personal_data```.
When using ```attr_pesel :name_of_attr``` in your model you will get new instance method available: ```rubyname_of_attr_personal_data```.

The method returns ```rubyActivepesel::PersonalData``` object which has the following attributes:

```ruby
```
date_of_birth:Date
sex:Integer
```

Sex attribute can take 3 values. 1 - for men, 2 - for women, 9 - unknown ([ISO/IEC 5218](http://en.wikipedia.org/wiki/ISO/IEC_5218))
Sex attribute can take 3 values. 1 - for men, 2 - for women, 9 - not applicable ([ISO/IEC 5218](http://en.wikipedia.org/wiki/ISO/IEC_5218))

For the invalid PESEL numbers the ```date_of_birth``` attribute is set to ```nil``` and the ```sex``` is 9 - not applicable.

# Using Activepesel outside ActiveModel / ActiveRecord models.

You can use it like in the given example

```
pesel = Activepesel::Pesel.new("82060202039")
pesel.valid? => true
pesel.get_personal_data => Activepesel::PersonalData(...)
```



Expand Down

0 comments on commit 65d8ff9

Please sign in to comment.