Class: Lavin::WebServer

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/lavin/web_server.rb

Instance Method Summary collapse

Instance Method Details

#find_persona(name = nil) ⇒ Object



90
91
92
93
94
95
# File 'lib/lavin/web_server.rb', line 90

def find_persona(name = nil)
  name ||= params['persona']
  Lavin::User.all_personas.find do |persona|
    persona.name == name
  end
end

#rewrite_config_value(new_value, old_value) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/lavin/web_server.rb', line 97

def rewrite_config_value(new_value, old_value)
  case old_value
  when TrueClass, FalseClass
    !!new_value
  when Integer
    new_value.to_i
  when Float
    new_value.to_f
  else
    new_value.to_s
  end
end