Class: Deck

Inherits:
Object
  • Object
show all
Defined in:
lib/classes/Deck.rb

Overview

require_relative “Card” DECK IS A PARENT CLASS

Direct Known Subclasses

Card

Constant Summary collapse

@@deck_counts =
0

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, deck_name, topic) ⇒ Deck

Returns a new instance of Deck.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/classes/Deck.rb', line 11

def initialize(id, deck_name, topic)
  @id = id
  @deck_name = deck_name
  @date_created = Time.new.to_s[0, 10]  
  @date_modified = @date_created
  @familiarity_rate = 0
  @card_counts = 0
  @test_counts = 0
  @familiar_card_counts = 0
  @topic = topic
end

Class Attribute Details

.card_countsObject

Returns the value of attribute card_counts.



42
43
44
# File 'lib/classes/Deck.rb', line 42

def card_counts
  @card_counts
end

.deck_countsObject

Returns the value of attribute deck_counts.



42
43
44
# File 'lib/classes/Deck.rb', line 42

def deck_counts
  @deck_counts
end

Instance Attribute Details

#card_countsObject

Returns the value of attribute card_counts.



7
8
9
# File 'lib/classes/Deck.rb', line 7

def card_counts
  @card_counts
end

#date_createdObject (readonly)

Returns the value of attribute date_created.



6
7
8
# File 'lib/classes/Deck.rb', line 6

def date_created
  @date_created
end

#date_modifiedObject

Returns the value of attribute date_modified.



7
8
9
# File 'lib/classes/Deck.rb', line 7

def date_modified
  @date_modified
end

#deck_nameObject

Returns the value of attribute deck_name.



7
8
9
# File 'lib/classes/Deck.rb', line 7

def deck_name
  @deck_name
end

#familiarity_rateObject (readonly)

Returns the value of attribute familiarity_rate.



6
7
8
# File 'lib/classes/Deck.rb', line 6

def familiarity_rate
  @familiarity_rate
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/classes/Deck.rb', line 6

def id
  @id
end

#test_countsObject (readonly)

Returns the value of attribute test_counts.



6
7
8
# File 'lib/classes/Deck.rb', line 6

def test_counts
  @test_counts
end

#topicObject

Returns the value of attribute topic.



7
8
9
# File 'lib/classes/Deck.rb', line 7

def topic
  @topic
end

Class Method Details

.add_deck_to_countObject



44
45
46
# File 'lib/classes/Deck.rb', line 44

def add_deck_to_count
  @@deck_counts += 1
end

.add_familiar_card_to_countObject



52
53
54
# File 'lib/classes/Deck.rb', line 52

def add_familiar_card_to_count
  @familiar_card_counts += 1
end

.add_test_to_countObject

add everytime a practice is attempted



48
49
50
# File 'lib/classes/Deck.rb', line 48

def add_test_to_count # add everytime a practice is attempted
  @test_counts += 1
end

Instance Method Details

#back_to_main_menuObject



67
68
69
# File 'lib/classes/Deck.rb', line 67

def back_to_main_menu
  # go back to main menu
end

#del_deck(deck_name) ⇒ Object



63
64
65
# File 'lib/classes/Deck.rb', line 63

def del_deck(deck_name)

end

#to_aObject

def calculate_familiarity_rate # divide familiar_card_counts by card_counts

@familiarity_rate = familiar_card_counts / card_counts

end



27
28
29
# File 'lib/classes/Deck.rb', line 27

def to_a
  [@id, @deck_name, @topic]
end

#view_deck(deck_name) ⇒ Object



58
59
60
61
# File 'lib/classes/Deck.rb', line 58

def view_deck(deck_name) 
  if deck_name == @deck_name
  end
end