simplestate 0.1.3 → 0.1.4

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -2
  3. data/lib/simplestate/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b3153ff78f8f75d2989bfe78b54a90d61f0ee94
4
- data.tar.gz: 734c4d1ec55579e707a7a5ce6a1a51afd25ab72f
3
+ metadata.gz: dc65445caaa1cac7f1bd911084c8e37f488ec29f
4
+ data.tar.gz: a41b3380697b0a2ede4571e914a1f5d42e0ab5fc
5
5
  SHA512:
6
- metadata.gz: 041594007f16771c4ae393339aa8d1d29d77be98c375794e0884c73c5e87d8fa74702dc2fad2e8abedf90d10dc634de2c00d75590d57a00828fb82afcc6dadaa
7
- data.tar.gz: e54fa9fced19ded450401386beedbbc24d6aa5891d99a79bbb91107aa805decc4168eebdfdeb0d14151b4fbd8d22e43e1dab8b2aaccb99e1169546398bef11a8
6
+ metadata.gz: b2f89ec0b6bc96f99f6d1948eec4b21e39d44928b52ac2b622d13b05d86b2ae665fc92a38724516a74102833159a9c2c5b85c1cdb4bf3bc0042700c748874926
7
+ data.tar.gz: 01c95d3b96244ca3f7a0b335733500ac6caa85a656d82df741ca378a8304db65c3fd4f4cc39cabb233574d23143b87f1655172452337b2d7dfd7eb853794da60
data/README.md CHANGED
@@ -29,9 +29,17 @@ Inherit from StateHolder to create the class of objects that will hold states:
29
29
 
30
30
  ```ruby
31
31
  class Button < StateHolder
32
+ attr_reader :color
33
+ def initialize(opts={})
34
+ @color = opts.fetch :color
35
+ super
36
+ end
37
+
32
38
  # button methods here
33
39
  end
34
40
  ```
41
+ If you want to set additional attributes at creation of a new button, new is called with an opts hash. Set the attribute from the opts hash in initialize. You !must! call super if you provide an initialize method in your holder class.
42
+
35
43
  Inherit from State to create a class to provide specific state behaviors:
36
44
 
37
45
  ```ruby
@@ -55,14 +63,14 @@ private
55
63
  end
56
64
  end
57
65
  ```
58
- The subclassed state may provide *private* enter and exit methods. Any other state methods intended to be available via a call to that method on the state holder must be public. #enter and #exit will always be called appropriately during state transitions.
66
+ The subclassed state may provide !private! enter and exit methods. Any other state methods intended to be available via a call to that method on the state holder must be public. #enter and #exit will always be called appropriately during state transitions.
59
67
 
60
68
  A state has access to methods on the state holder via #holder:
61
69
 
62
70
  ```ruby
63
71
  holder.a_special_holder_method
64
72
  ```
65
- Creation of a holder instance *must* specify the initial state class:
73
+ Creation of a holder instance !must! specify the initial state class:
66
74
 
67
75
  ```ruby
68
76
  button = Button.new(initial_state_class: Off)
@@ -1,3 +1,3 @@
1
1
  module Simplestate
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplestate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitchell C Kuppinger