Class: Lifter::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/lifter/config.rb

Defined Under Namespace

Classes: Webhook

Instance Method Summary collapse

Constructor Details

#initialize(&definition) ⇒ Config

Returns a new instance of Config.



5
6
7
8
9
10
11
12
# File 'lib/lifter/config.rb', line 5

def initialize(&definition)
  # Defaults
  @config = {
    host: '127.0.0.1'
  }

  instance_eval(&definition)
end

Instance Method Details

#authorize_webhook(method, url) ⇒ Object



46
47
48
# File 'lib/lifter/config.rb', line 46

def authorize_webhook(method, url)
  @config[:authorize_webhook] = Webhook.new(method, url)
end

#completed_webhook(method, url) ⇒ Object



50
51
52
# File 'lib/lifter/config.rb', line 50

def completed_webhook(method, url)
  @config[:completed_webhook] = Webhook.new(method, url)
end

#get(key) ⇒ Object

Raises:

  • (ArgumentError)


14
15
16
17
18
19
20
# File 'lib/lifter/config.rb', line 14

def get(key)
  key = key.to_sym

  raise ArgumentError.new('unknown key') if !@config.has_key?(key)

  @config[key]
end

#host(host) ⇒ Object



22
23
24
# File 'lib/lifter/config.rb', line 22

def host(host)
  @config[:host] = host
end

#max_upload_size(max_upload_size) ⇒ Object



38
39
40
# File 'lib/lifter/config.rb', line 38

def max_upload_size(max_upload_size)
  @config[:max_upload_size] = max_upload_size
end

#port(port) ⇒ Object



26
27
28
# File 'lib/lifter/config.rb', line 26

def port(port)
  @config[:port] = port.to_i
end

#upload_hash_method(upload_hash_method) ⇒ Object



34
35
36
# File 'lib/lifter/config.rb', line 34

def upload_hash_method(upload_hash_method)
  @config[:upload_hash_method] = upload_hash_method
end

#upload_prologue_size(upload_prologue_size) ⇒ Object



42
43
44
# File 'lib/lifter/config.rb', line 42

def upload_prologue_size(upload_prologue_size)
  @config[:upload_prologue_size] = upload_prologue_size
end

#working_dir(path) ⇒ Object



30
31
32
# File 'lib/lifter/config.rb', line 30

def working_dir(path)
  @config[:working_dir] = path
end