Module: Hotsheet

Extended by:
Config
Defined in:
lib/hotsheet.rb,
lib/hotsheet/version.rb,
lib/generators/hotsheet/install_generator.rb

Defined Under Namespace

Modules: Config, Generators Classes: ApplicationController, Column, Engine, Error, HomeController, Sheet, SheetsController

Constant Summary collapse

CONFIG =
{}.freeze
I18N =
Psych.load_file(Hotsheet::Engine.root.join("config/locales/en.yml"))["en"]["hotsheet"].freeze
VERSION =
"0.2.3"

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Config

merge_config!

Class Attribute Details

.configObject (readonly)

Returns the value of attribute config.



16
17
18
# File 'lib/hotsheet.rb', line 16

def config
  @config
end

Class Method Details

.configure(config = {}, &sheets) ⇒ Object



20
21
22
23
# File 'lib/hotsheet.rb', line 20

def configure(config = {}, &sheets)
  @config = [merge_config!(CONFIG, config), sheets]
  self
end

.sheetsObject



25
26
27
28
29
30
31
# File 'lib/hotsheet.rb', line 25

def sheets
  @sheets ||= begin
    @sheets = {}
    instance_eval(&@config.pop)
    @sheets
  end
end

.t(key, **kwargs) ⇒ Object



35
36
37
# File 'lib/hotsheet.rb', line 35

def t(key, **kwargs)
  I18n.t "hotsheet.#{key}", default: I18N[key], **kwargs
end