Class: Prospectus::State
- Inherits:
-
Object
- Object
- Prospectus::State
- Defined in:
- lib/prospectus/state.rb
Overview
Define a state object that supports modular checks
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #=~(other) ⇒ Object
-
#initialize(params = {}) ⇒ State
constructor
A new instance of State.
- #to_s ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ State
7 8 9 |
# File 'lib/prospectus/state.rb', line 7 def initialize(params = {}) @options = params end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
5 6 7 |
# File 'lib/prospectus/state.rb', line 5 def value @value end |
Class Method Details
Instance Method Details
#=~(other) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/prospectus/state.rb', line 19 def =~(other) return super unless other.is_a? Prospectus::State ov = other.value return ov.include?(@value) if ov.is_a? Enumerable return @value =~ ov if ov.is_a? Regexp @value == ov end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/prospectus/state.rb', line 27 def to_s @value.to_s end |