Module: Easy::Configuration

Extended by:
ActiveSupport::Autoload
Defined in:
lib/easy/configuration.rb,
lib/easy/configuration/auth.rb,
lib/easy/configuration/menu.rb,
lib/easy/configuration/custom.rb,
lib/easy/configuration/entity.rb,
lib/easy/configuration/railtie.rb,
lib/easy/configuration/version.rb,
lib/easy/configuration/menu_item.rb,
lib/easy/configuration/structure.rb,
lib/easy/configuration/menu_title.rb,
lib/easy/configuration/menu_custom_link.rb,
lib/easy/configuration/menu_entity_link.rb,
lib/easy/configuration/patches/active_record.rb

Defined Under Namespace

Modules: Auth, Patches Classes: Custom, Entity, Menu, MenuCustomLink, MenuEntityLink, MenuItem, MenuTitle, Railtie, Structure

Constant Summary collapse

VERSION =
'0.5.1'

Class Method Summary collapse

Class Method Details

.auth(&block) ⇒ Object



73
74
75
76
77
78
79
# File 'lib/easy/configuration.rb', line 73

def auth(&block)
  if block_given?
    yield Auth
  else
    Auth
  end
end

.customObject



89
90
91
# File 'lib/easy/configuration.rb', line 89

def custom
  @custom ||= Custom.new
end

.entity(klass_or_name, &block) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/easy/configuration.rb', line 51

def entity(klass_or_name, &block)
  k = klass_or_name.is_a?(String) ? klass_or_name : klass_or_name.name.underscore

  self._entities[k] ||= Entity.new(k)

  if block_given?
    yield self._entities[k]
  else
    self._entities[k]
  end
end

.hostObject



47
48
49
# File 'lib/easy/configuration.rb', line 47

def host
  "#{protocol}://#{host_name}"
end


63
64
65
66
67
68
69
70
71
# File 'lib/easy/configuration.rb', line 63

def menu(section, &block)
  self._menu[section.to_s] ||= Menu.new

  if block_given?
    yield self._menu[section.to_s]
  else
    self._menu[section.to_s]
  end
end

.secretsObject



93
94
95
# File 'lib/easy/configuration.rb', line 93

def secrets
  Rails.application.secrets
end

.sitesObject



81
82
83
84
85
86
87
# File 'lib/easy/configuration.rb', line 81

def sites
  @sites ||= begin
    h = ::ActiveSupport::OrderedOptions.new
    h.merge!(secrets.sites || {})
    h
  end
end