Class: Toast::ConfigDSL::Settings

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/toast/config_dsl/settings.rb

Defined Under Namespace

Classes: AuthenticateContext

Instance Method Summary collapse

Methods included from Common

#check_symbol_list, #initialize, #method_missing, #raise_config_error, #stack_push

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Toast::ConfigDSL::Common

Instance Method Details

#authenticate(&block) ⇒ Object



32
33
34
# File 'lib/toast/config_dsl/settings.rb', line 32

def authenticate &block
  Toast.settings.authenticate = block
end

#link_unlink_via_post(boolean) ⇒ Object



28
29
30
# File 'lib/toast/config_dsl/settings.rb', line 28

def link_unlink_via_post boolean
  Toast.settings.link_unlink_via_post = boolean
end

#max_window(size) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/toast/config_dsl/settings.rb', line 18

def max_window size
  if size.is_a?(Integer) and size > 0
    Toast.settings.max_window = size
  elsif size == :unlimited
    Toast.settings.max_window = 10**6 # yes that's inifinity 
  else
    raise_config_error 'max_window must a positive integer or :unlimited'
  end
end

#toast_settings(&block) ⇒ Object



12
13
14
15
16
# File 'lib/toast/config_dsl/settings.rb', line 12

def toast_settings &block
  stack_push 'toast_settings' do
    self.instance_eval &block
  end
end