def scope
scope_hash = [settings.force_mode,state.total].hash
return @state.scope unless @state.scope.nil? or scope_hash != @state.scope_hash
state.scope_at = [
settings.force_mode || ($stdout.isatty ? :tty : :notty),
:unknown == state.total ? :infinite : :finite
]
state.scope = state.settings
state.scope_at.each do |s|
begin
state.scope = state.scope[s]
rescue NoMethodError
raise StandardError, "Invalid configuration: #{state.scope_at.join('.')} "+
"(Can't resolve: #{state.scope_at[state.scope_at.index(s)-1]})"
end
end
state.scope_hash = scope_hash
state.scope
end