Module: LetMeIn
- Defined in:
- lib/letmein.rb
Defined Under Namespace
Modules: Model
Classes: Config, Railtie, Session
Constant Summary
collapse
- Error =
Class.new StandardError
Class Method Summary
collapse
Class Method Details
.accessor(name, index = 0) ⇒ Object
134
135
136
137
|
# File 'lib/letmein.rb', line 134
def self.accessor(name, index = 0)
name = name.to_s.pluralize
self.config.send(name)[index] || self.config.send(name)[0]
end
|
.config ⇒ Object
125
126
127
|
# File 'lib/letmein.rb', line 125
def self.config
@config ||= Config.new
end
|
129
130
131
|
# File 'lib/letmein.rb', line 129
def self.configure
yield config
end
|
.initialize ⇒ Object
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
# File 'lib/letmein.rb', line 133
def self.initialize
def self.accessor(name, index = 0)
name = name.to_s.pluralize
self.config.send(name)[index] || self.config.send(name)[0]
end
self.config.models.each do |model|
klass = model.constantize rescue next
klass.send :include, LetMeIn::Model
session_model = "#{model.to_s.camelize}Session"
Object.send(:remove_const, session_model) if (Object.const_get(session_model) rescue nil)
Object.const_set(session_model, Class.new(LetMeIn::Session))
end
end
|