Class: ContentWidget
- Inherits:
-
Object
- Object
- ContentWidget
- Includes:
- EnumField::DefineEnum
- Defined in:
- app/models/content_widget.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#regexp ⇒ Object
readonly
Returns the value of attribute regexp.
-
#sample ⇒ Object
readonly
Returns the value of attribute sample.
Instance Method Summary collapse
- #cells? ⇒ Boolean
-
#initialize(code, regexp, sample, is_cells = false) ⇒ ContentWidget
constructor
A new instance of ContentWidget.
- #title ⇒ Object
Constructor Details
#initialize(code, regexp, sample, is_cells = false) ⇒ ContentWidget
Returns a new instance of ContentWidget.
8 9 10 11 12 13 14 |
# File 'app/models/content_widget.rb', line 8 def initialize(code, regexp, sample, is_cells = false) @code = code.to_sym @regexp = regexp.is_a?(Regexp) ? regexp : Regexp.new(regexp) @sample = sample @file = ['content_widgets', code].join('/') @is_cells = is_cells end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'app/models/content_widget.rb', line 6 def code @code end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
6 7 8 |
# File 'app/models/content_widget.rb', line 6 def file @file end |
#regexp ⇒ Object (readonly)
Returns the value of attribute regexp.
6 7 8 |
# File 'app/models/content_widget.rb', line 6 def regexp @regexp end |
#sample ⇒ Object (readonly)
Returns the value of attribute sample.
6 7 8 |
# File 'app/models/content_widget.rb', line 6 def sample @sample end |
Instance Method Details
#cells? ⇒ Boolean
16 17 18 |
# File 'app/models/content_widget.rb', line 16 def cells? @is_cells end |
#title ⇒ Object
20 21 22 |
# File 'app/models/content_widget.rb', line 20 def title I18n.t(code, scope: [:content_widget]) end |