23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/self-control.rb', line 23
def selfcontrol(state=nil)
return false unless selfcontrol_builder.is_a?(SelfControl::Builder)
state ||= :default unless state_column = selfcontrol_builder.state_column
state ||= (self.respond_to?(state_column) ? self.send(state_column) : :default).to_sym
@selfcontrol_flows ||= {}
return @selfcontrol_flows[state] if @selfcontrol_flows[state].is_a?(SelfControl::Flow)
return false unless builder = selfcontrol_builder.flows[state]
@selfcontrol_flows[state] = SelfControl::Flow.new(builder, self)
end
|