Class: Toogle::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/toogle/query.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title = nil, link = nil, description = nil) ⇒ Query

Returns a new instance of Query.



7
8
9
10
11
12
# File 'lib/toogle/query.rb', line 7

def initialize(title=nil, link=nil, description=nil)
    @title = title
    @link = link 
    @description = description
    @@all << self
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



5
6
7
# File 'lib/toogle/query.rb', line 5

def description
  @description
end

Returns the value of attribute link.



5
6
7
# File 'lib/toogle/query.rb', line 5

def link
  @link
end

#titleObject

Returns the value of attribute title.



5
6
7
# File 'lib/toogle/query.rb', line 5

def title
  @title
end

Class Method Details

.allObject



28
29
30
# File 'lib/toogle/query.rb', line 28

def self.all 
    @@all
end

.createObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/toogle/query.rb', line 14

def self.create
    data = Toogle::CLI.new
    queried_data = data.
    i = 0
    while i < queried_data[:titles].length
        this_title = queried_data[:titles][i]
        this_link = queried_data[:links][i]
        this_desc = queried_data[:descriptions][i]
        self.new(this_title, this_link, this_desc)
        
        i += 1
    end
end