Class: Milktea::Config

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

Overview

Configuration class for Milktea applications

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Config

Returns a new instance of Config.

Yields:

  • (_self)

Yield Parameters:



9
10
11
12
13
14
15
16
17
# File 'lib/milktea/config.rb', line 9

def initialize
  @autoload_dirs = ["app/models"]
  @output = $stdout
  @hot_reloading = nil # Will be set by lazy evaluation
  @runtime = nil # Will be set by lazy evaluation
  @renderer = nil # Will be set by lazy evaluation

  yield(self) if block_given?
end

Instance Attribute Details

#autoload_dirsObject

Returns the value of attribute autoload_dirs.



6
7
8
# File 'lib/milktea/config.rb', line 6

def autoload_dirs
  @autoload_dirs
end

#hot_reloading=(value) ⇒ Object (writeonly)

Sets the attribute hot_reloading

Parameters:

  • value

    the value to set the attribute hot_reloading to.



7
8
9
# File 'lib/milktea/config.rb', line 7

def hot_reloading=(value)
  @hot_reloading = value
end

#outputObject

Returns the value of attribute output.



6
7
8
# File 'lib/milktea/config.rb', line 6

def output
  @output
end

#rendererObject



27
28
29
# File 'lib/milktea/config.rb', line 27

def renderer
  @renderer ||= Renderer.new(@output)
end

#runtimeObject



23
24
25
# File 'lib/milktea/config.rb', line 23

def runtime
  @runtime ||= Runtime.new
end

Instance Method Details

#autoload_pathsObject



31
32
33
# File 'lib/milktea/config.rb', line 31

def autoload_paths
  @autoload_dirs.map { |dir| Milktea.root.join(dir) }
end

#hot_reloading?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/milktea/config.rb', line 19

def hot_reloading?
  @hot_reloading || (Milktea.env == :development)
end