Class: SuperState::StateArray
- Inherits:
-
Array
- Object
- Array
- SuperState::StateArray
- Defined in:
- lib/super_state.rb
Overview
I want to know the states are the same
Instance Method Summary collapse
- #<<(value) ⇒ Object
- #all_states! ⇒ Object
- #all_states? ⇒ Boolean
- #for_select ⇒ Object
- #include?(value) ⇒ Boolean
-
#initialize(array = nil) ⇒ StateArray
constructor
A new instance of StateArray.
Constructor Details
#initialize(array = nil) ⇒ StateArray
Returns a new instance of StateArray.
34 35 36 |
# File 'lib/super_state.rb', line 34 def initialize(array=nil) super(SuperState.canonicalise(Array(array))) end |
Instance Method Details
#<<(value) ⇒ Object
38 39 40 |
# File 'lib/super_state.rb', line 38 def <<(value) super(SuperState.canonicalise(value)) end |
#all_states! ⇒ Object
52 53 54 55 |
# File 'lib/super_state.rb', line 52 def all_states! @all_states = true self end |
#all_states? ⇒ Boolean
57 58 59 |
# File 'lib/super_state.rb', line 57 def all_states? @all_states end |
#for_select ⇒ Object
46 47 48 49 50 |
# File 'lib/super_state.rb', line 46 def for_select self.map do |value| [value.humanize, value] end end |
#include?(value) ⇒ Boolean
42 43 44 |
# File 'lib/super_state.rb', line 42 def include?(value) super(SuperState.canonicalise(value)) end |