hard_boiled 0.2.1 → 0.2.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/README.md CHANGED
@@ -1,15 +1,15 @@
1
1
  ## HardBoiled
2
2
 
3
- simply define mapping from you model to a simple hash. For those who worked with [thoughtbot](http://thoughtbot.com)'s [factory girl](http://github.com/thoughtbot/factory_girl) the DSL should be familiar.
3
+ simply define a mapping from your model to a simple hash. For those who worked with [thoughtbot](http://thoughtbot.com)'s [factory girl](http://github.com/thoughtbot/factory_girl) the DSL should be familiar.
4
4
 
5
5
  ### Installation
6
6
 
7
- gem install hard-boiled
7
+ gem install hard_boiled
8
8
 
9
9
  ### Usage
10
10
 
11
11
  ```ruby
12
- require 'hard-boiled'
12
+ require 'hard_boiled'
13
13
 
14
14
  egg = OpenStruct.new({
15
15
  :boil_time => 7,
@@ -21,14 +21,31 @@ HardBoiled::Presenter.define egg do
21
21
  time :from => :boil_time
22
22
  colour
23
23
  temperature :format => "%d ℃"
24
- end # => { :time => 7, :temperature => "99 ℃", :colour => "beige" }
24
+ end
25
+ # => { :time => 7, :temperature => "99 ℃", :colour => "beige" }
26
+
27
+ # Or with traits
28
+
29
+ HardBoiled::Presenter.define(egg, :only => [:instructions]) do
30
+ with_trait(:instructions) do
31
+ time :from => :boil_time
32
+ temperature :format => "%d ℃"
33
+ end
34
+
35
+ with_trait(:presentation) do
36
+ colour
37
+ end
38
+
39
+ omnipresent_slogan "proudly produced on organic farms"
40
+ end
41
+ # => { :time => 7, :temperature => "99 ℃", :omnipresent_slogan => "proudly produced on organic farms" }
25
42
  ```
26
43
 
27
44
  for more examples see the tests in the `spec` directory.
28
45
 
29
46
  ### Similar Projects
30
47
 
31
- If _hard-boiled_ isn't your cup of tea, go and check out other ways to map models
48
+ If _hard\_boiled_ isn't your cup of tea, go and check out other ways to map models
32
49
  to hashes (for data serialization):
33
50
 
34
51
  * [Representative](https://github.com/mdub/representative)
@@ -1,3 +1,3 @@
1
1
  module HardBoiled
2
- autoload :Presenter, 'hard-boiled/presenter'
2
+ autoload :Presenter, 'hard_boiled/presenter'
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module HardBoiled
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hard_boiled
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: