Class: LesliBabel::Module
- Inherits:
-
ApplicationRecord
- Object
- Lesli::ApplicationLesliRecord
- ApplicationRecord
- LesliBabel::Module
- Defined in:
- app/models/lesli_babel/module.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.index ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/models/lesli_babel/module.rb', line 9 def self.index Module.where("name is not null") order(id: :desc).map do |translation_module| { id: translation_module[:id], name: translation_module[:name], code: translation_module[:name].downcase, platform: translation_module[:platform] } end end |
Instance Method Details
#format_module_name ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/lesli_babel/module.rb', line 30 def format_module_name return if self.code == "main_app" return if self.platform == "lesli_core" return if self.platform == "lesli_engine" self.code = self.code .gsub(/[^0-9A-Za-z\s\-\_]/, '') # remove special characters from string .gsub(/-/, '') # replace dashes with underscore .gsub(/_/, '') # replace underscore with underscore .gsub(/\s+/, '') # remove blank spaces end |
#show ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/models/lesli_babel/module.rb', line 21 def show { :id => self.id, :code => self.code.titleize, :platform => self.platform, :created_at => self.created_at } end |