Class: Component
- Inherits:
-
Object
- Object
- Component
- Defined in:
- app/models/component.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#example ⇒ Object
Returns the value of attribute example.
-
#name ⇒ Object
Returns the value of attribute name.
-
#section ⇒ Object
Returns the value of attribute section.
-
#source ⇒ Object
Returns the value of attribute source.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'app/models/component.rb', line 4 def description @description end |
#example ⇒ Object
Returns the value of attribute example.
4 5 6 |
# File 'app/models/component.rb', line 4 def example @example end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'app/models/component.rb', line 4 def name @name end |
#section ⇒ Object
Returns the value of attribute section.
4 5 6 |
# File 'app/models/component.rb', line 4 def section @section end |
#source ⇒ Object
Returns the value of attribute source.
4 5 6 |
# File 'app/models/component.rb', line 4 def source @source end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'app/models/component.rb', line 4 def url @url end |
Instance Method Details
#display_description ⇒ Object
6 7 8 |
# File 'app/models/component.rb', line 6 def display_description RDiscount.new(self.description, :smart, :filter_html).to_html.html_safe if self.description end |
#display_example ⇒ Object
10 11 12 |
# File 'app/models/component.rb', line 10 def display_example ERB.new(example).result if self.example end |
#slug ⇒ Object
14 15 16 |
# File 'app/models/component.rb', line 14 def slug self.name.downcase.gsub(/[^a-z1-9]+/, '-').chomp('-') end |