class Prospectus::State
Define a state object that supports modular checks
Attributes
value[RW]
Public Class Methods
from_block(params = {}, state = nil, &block)
click to toggle source
# File lib/prospectus/state.rb, line 11 def self.from_block(params = {}, state = nil, &block) state ||= State.new(params) dsl = StateDSL.new(state, params) dsl.instance_eval(&block) dsl.load! state end
new(params = {})
click to toggle source
# File lib/prospectus/state.rb, line 7 def initialize(params = {}) @options = params end
Public Instance Methods
=~(other)
click to toggle source
Calls superclass method
# 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()
click to toggle source
# File lib/prospectus/state.rb, line 27 def to_s @value.to_s end