mutator 0.0.1 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 847fc513438a0e0cc7e5b9843d93a38f99b7366d
4
- data.tar.gz: 4da10747a40b0dad72f827f5d70a38b2042aeb11
3
+ metadata.gz: 266ddb73a57d444d63b9f9460df79a5eb8d19089
4
+ data.tar.gz: 8597a08ee353f97a42a3d7469bf187c494ce1723
5
5
  SHA512:
6
- metadata.gz: 23aee1ed4688d2df18d93766cd72744a860168b1b4a70f9a2b60b11af8214c35de5f718f72b3963a58d2753000c3459d7e063868f370cbac8d03922219d55da3
7
- data.tar.gz: 5cf8f1182e50133c991c72b962f6b805c8142f3197483cbc54be8e7a2bed5f801fe9887f65d5ce3f98cdb82b36c129688e04712a25604810c0490eedb1fee991
6
+ metadata.gz: 0f84541de39489ad4dab75b699e895b9f552cf86b0302cc02c93865d64001f43a646d7726515432bb29656df2a6987546122c7906c79047606a1ee0f8f73fb8e
7
+ data.tar.gz: 0e640ac518c45bf09731a77201096c1d57d860fc34ca8e7c90dc85f58e93222fee50d1c9fd9e4b355bf7adc38705f0d274ab2eebd86b3f4779817a813d1d398b
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Yet another state machine
1
+ # Mutator
2
2
 
3
- Ya, this is another state machine gem. Why? Well, among the major state machine gems I found, they didn't quite do what I was looking for. So I wrote my own. Plus, reinventing the wheel is fun!
3
+ Yes, this is another state machine gem. Why? Well, among the major state machine gems I found, they didn't quite do what I was looking for. So I wrote my own. Plus, reinventing the wheel is fun!
4
4
 
5
5
  ## Installation
6
6
 
@@ -108,6 +108,17 @@ end
108
108
 
109
109
  Now you can always use `machine.deliver!` to do the transition to delivered.
110
110
 
111
+ ### Where are my scopes?
112
+
113
+ Way back at the beginning when we included `Mutator::Helpers`, that defined class methods on `Wonder` for each invoice.
114
+
115
+ ``` ruby
116
+ Wonder.machine.states #=> [:signed, :sealed, :delivered, :yours]
117
+ Wonder.signed #=> Wonder.where(state: :signed)
118
+ Wonder.sealed #=> Wonder.where(state: :sealed)
119
+ [...]
120
+ ```
121
+
111
122
  ### That's all folks!
112
123
 
113
124
  That's more or less it. You may or may not like the way I've done this state machine, but it works for the purposes I need it for. I'm happy to discuss changes or reasoning behind certain things. There isn't a ton of code so feel free to poke around!
@@ -5,7 +5,7 @@ module Mutator
5
5
  end
6
6
 
7
7
  def self.included(base)
8
- "Machines::#{base.name}".constantize.states.each do |state|
8
+ "Mutator::#{base.name}".constantize.states.each do |state|
9
9
  base.send(:define_singleton_method, state) do
10
10
  self.where(state: state)
11
11
  end
@@ -15,7 +15,7 @@ module Mutator
15
15
  protected
16
16
 
17
17
  def machine_class
18
- "Machines::#{self.class.name}".constantize
18
+ "Mutator::#{self.class.name}".constantize
19
19
  end
20
20
  end
21
21
  end
@@ -1,3 +1,3 @@
1
1
  module Mutator
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mutator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-09 00:00:00.000000000 Z
11
+ date: 2014-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler