Class: WidgetType
- Inherits:
-
Object
- Object
- WidgetType
- Includes:
- EnumField::DefineEnum
- Defined in:
- app/models/enums/widget_type.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code, params = {}) ⇒ WidgetType
constructor
A new instance of WidgetType.
- #title ⇒ Object
Constructor Details
#initialize(code, params = {}) ⇒ WidgetType
Returns a new instance of WidgetType.
8 9 10 11 |
# File 'app/models/enums/widget_type.rb', line 8 def initialize(code, params = {}) @code = code.to_sym @params = params end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'app/models/enums/widget_type.rb', line 6 def code @code end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
6 7 8 |
# File 'app/models/enums/widget_type.rb', line 6 def params @params end |
Class Method Details
.common ⇒ Object
17 18 19 |
# File 'app/models/enums/widget_type.rb', line 17 def self.common all.select { |i| i.params[:only].blank? } end |
Instance Method Details
#title ⇒ Object
13 14 15 |
# File 'app/models/enums/widget_type.rb', line 13 def title I18n.t(code, scope: [:widget_type]) end |