Class: Adalog::Web
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Adalog::Web
- Defined in:
- lib/adalog/web.rb
Defined Under Namespace
Classes: Config
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#/ ⇒ Object
The primary page that matters in this simple little log.
- #default_options ⇒ Object
- #determine_config_settings(config, options) ⇒ Object
-
#initialize(app = nil, web_options = {}) ⇒ Web
constructor
A new instance of Web.
- #sinatra_class_option_overrides(options) ⇒ Object
Constructor Details
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/adalog/web.rb', line 7 def config @config end |
Instance Method Details
#/ ⇒ Object
The primary page that matters in this simple little log.
72 73 74 75 |
# File 'lib/adalog/web.rb', line 72 get '/' do @entries = config.repo.all erb :'index.html' end |
#default_options ⇒ Object
35 36 37 |
# File 'lib/adalog/web.rb', line 35 def Adalog.configuration.web_defaults end |
#determine_config_settings(config, options) ⇒ Object
18 19 20 21 22 |
# File 'lib/adalog/web.rb', line 18 def determine_config_settings(config, ) config.repo = .fetch(:repo) config.heading = .fetch(:heading) config.time_format = .fetch(:time_format) end |
#sinatra_class_option_overrides(options) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/adalog/web.rb', line 25 def sinatra_class_option_overrides() if .key?(:erb_layout) class_exec { set :erb, layout: [:erb_layout] } end if .key?(:views_folder) class_exec { set :views, [:views_folder] } end end |