Class: Content
- Inherits:
-
Object
- Object
- Content
- Defined in:
- lib/models/content.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#keywords ⇒ Object
readonly
Returns the value of attribute keywords.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(title, description, keywords, link = "Link not provided") ⇒ Content
constructor
A new instance of Content.
Constructor Details
#initialize(title, description, keywords, link = "Link not provided") ⇒ Content
Returns a new instance of Content.
7 8 9 10 11 12 13 14 15 |
# File 'lib/models/content.rb', line 7 def initialize(title, description, keywords, link="Link not provided") @title = title @description = description @keywords = keywords @link = link #adds instance of Content to @@all @@all << self end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
2 3 4 |
# File 'lib/models/content.rb', line 2 def description @description end |
#keywords ⇒ Object (readonly)
Returns the value of attribute keywords.
2 3 4 |
# File 'lib/models/content.rb', line 2 def keywords @keywords end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
2 3 4 |
# File 'lib/models/content.rb', line 2 def link @link end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
2 3 4 |
# File 'lib/models/content.rb', line 2 def title @title end |
Class Method Details
.add_content(title, description, keywords, link) ⇒ Object
25 26 27 |
# File 'lib/models/content.rb', line 25 def self.add_content(title, description, keywords, link) Content.new(title, description, keywords, link) end |
.all ⇒ Object
21 22 23 |
# File 'lib/models/content.rb', line 21 def self.all @@all end |
.clear_search ⇒ Object
17 18 19 |
# File 'lib/models/content.rb', line 17 def self.clear_search @@all.clear end |