Class: Content

Inherits:
Object
  • Object
show all
Defined in:
lib/models/content.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#descriptionObject (readonly)

Returns the value of attribute description.



2
3
4
# File 'lib/models/content.rb', line 2

def description
  @description
end

#keywordsObject (readonly)

Returns the value of attribute keywords.



2
3
4
# File 'lib/models/content.rb', line 2

def keywords
  @keywords
end

Returns the value of attribute link.



2
3
4
# File 'lib/models/content.rb', line 2

def link
  @link
end

#titleObject (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

.allObject



21
22
23
# File 'lib/models/content.rb', line 21

def self.all
  @@all
end

.clear_searchObject



17
18
19
# File 'lib/models/content.rb', line 17

def self.clear_search
  @@all.clear
end