Class: AwesomeTranslations::Handler
- Inherits:
-
Object
- Object
- AwesomeTranslations::Handler
- Defined in:
- app/models/awesome_translations/handler.rb
Class Method Summary collapse
Instance Method Summary collapse
- #const ⇒ Object
- #groups ⇒ Object
- #id ⇒ Object
-
#initialize(data) ⇒ Handler
constructor
A new instance of Handler.
- #instance ⇒ Object
- #name ⇒ Object
- #to_param ⇒ Object
Constructor Details
#initialize(data) ⇒ Handler
Returns a new instance of Handler.
16 17 18 |
# File 'app/models/awesome_translations/handler.rb', line 16 def initialize(data) @data = data end |
Class Method Details
.all ⇒ Object
4 5 6 |
# File 'app/models/awesome_translations/handler.rb', line 4 def self.all AwesomeTranslations::Handlers.list end |
.find(id) ⇒ Object
8 9 10 11 12 13 14 |
# File 'app/models/awesome_translations/handler.rb', line 8 def self.find(id) AwesomeTranslations::Handlers.list.each do |handler| return handler if handler.id == id.to_s end raise ActiveRecord::RecordNotFound, "Handlers not found: '#{id}'." end |
Instance Method Details
#const ⇒ Object
32 33 34 |
# File 'app/models/awesome_translations/handler.rb', line 32 def const AwesomeTranslations::Handlers.const_get(@data.fetch(:const_name)) end |
#groups ⇒ Object
40 41 42 |
# File 'app/models/awesome_translations/handler.rb', line 40 def groups const.new.groups end |
#id ⇒ Object
20 21 22 |
# File 'app/models/awesome_translations/handler.rb', line 20 def id @data.fetch(:id) end |
#instance ⇒ Object
36 37 38 |
# File 'app/models/awesome_translations/handler.rb', line 36 def instance const.new end |
#name ⇒ Object
28 29 30 |
# File 'app/models/awesome_translations/handler.rb', line 28 def name @data.fetch(:name) end |
#to_param ⇒ Object
24 25 26 |
# File 'app/models/awesome_translations/handler.rb', line 24 def to_param id end |