Class: Deck
- Inherits:
-
Object
- Object
- Deck
- Defined in:
- lib/classes/Deck.rb
Overview
require_relative “Card” DECK IS A PARENT CLASS
Direct Known Subclasses
Constant Summary collapse
- @@deck_counts =
0
Class Attribute Summary collapse
-
.card_counts ⇒ Object
Returns the value of attribute card_counts.
-
.deck_counts ⇒ Object
Returns the value of attribute deck_counts.
Instance Attribute Summary collapse
-
#card_counts ⇒ Object
Returns the value of attribute card_counts.
-
#date_created ⇒ Object
readonly
Returns the value of attribute date_created.
-
#date_modified ⇒ Object
Returns the value of attribute date_modified.
-
#deck_name ⇒ Object
Returns the value of attribute deck_name.
-
#familiarity_rate ⇒ Object
readonly
Returns the value of attribute familiarity_rate.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#test_counts ⇒ Object
readonly
Returns the value of attribute test_counts.
-
#topic ⇒ Object
Returns the value of attribute topic.
Class Method Summary collapse
- .add_deck_to_count ⇒ Object
- .add_familiar_card_to_count ⇒ Object
-
.add_test_to_count ⇒ Object
add everytime a practice is attempted.
Instance Method Summary collapse
- #back_to_main_menu ⇒ Object
- #del_deck(deck_name) ⇒ Object
-
#initialize(id, deck_name, topic) ⇒ Deck
constructor
A new instance of Deck.
-
#to_a ⇒ Object
def calculate_familiarity_rate # divide familiar_card_counts by Deck.card_counts @familiarity_rate = familiar_card_counts / card_counts end.
- #view_deck(deck_name) ⇒ Object
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_counts ⇒ Object
Returns the value of attribute card_counts.
42 43 44 |
# File 'lib/classes/Deck.rb', line 42 def card_counts @card_counts end |
.deck_counts ⇒ Object
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_counts ⇒ Object
Returns the value of attribute card_counts.
7 8 9 |
# File 'lib/classes/Deck.rb', line 7 def card_counts @card_counts end |
#date_created ⇒ Object (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_modified ⇒ Object
Returns the value of attribute date_modified.
7 8 9 |
# File 'lib/classes/Deck.rb', line 7 def date_modified @date_modified end |
#deck_name ⇒ Object
Returns the value of attribute deck_name.
7 8 9 |
# File 'lib/classes/Deck.rb', line 7 def deck_name @deck_name end |
#familiarity_rate ⇒ Object (readonly)
Returns the value of attribute familiarity_rate.
6 7 8 |
# File 'lib/classes/Deck.rb', line 6 def familiarity_rate @familiarity_rate end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/classes/Deck.rb', line 6 def id @id end |
#test_counts ⇒ Object (readonly)
Returns the value of attribute test_counts.
6 7 8 |
# File 'lib/classes/Deck.rb', line 6 def test_counts @test_counts end |
#topic ⇒ Object
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_count ⇒ Object
44 45 46 |
# File 'lib/classes/Deck.rb', line 44 def add_deck_to_count @@deck_counts += 1 end |
.add_familiar_card_to_count ⇒ Object
52 53 54 |
# File 'lib/classes/Deck.rb', line 52 def add_familiar_card_to_count @familiar_card_counts += 1 end |
.add_test_to_count ⇒ Object
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_menu ⇒ Object
67 68 69 |
# File 'lib/classes/Deck.rb', line 67 def # 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_a ⇒ Object
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 |