Class: HDeck::Card

Inherits:
Object
  • Object
show all
Defined in:
lib/hdeck/card.rb

Overview

An individual Harrow card unit, described on this page: pathfinder.fandom.com/wiki/List_of_harrow_cards

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Card

Returns a new instance of Card.



7
8
9
10
11
# File 'lib/hdeck/card.rb', line 7

def initialize(args)
  args.each do |k, v|
    instance_variable_set("@#{k}", v) unless v.nil?
  end
end

Instance Attribute Details

#abilityObject

Returns the value of attribute ability.



5
6
7
# File 'lib/hdeck/card.rb', line 5

def ability
  @ability
end

#descObject

Returns the value of attribute desc.



5
6
7
# File 'lib/hdeck/card.rb', line 5

def desc
  @desc
end

#moralityObject

Returns the value of attribute morality.



5
6
7
# File 'lib/hdeck/card.rb', line 5

def morality
  @morality
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/hdeck/card.rb', line 5

def name
  @name
end

Instance Method Details

#to_sObject



13
14
15
# File 'lib/hdeck/card.rb', line 13

def to_s
  "(#{ability}: #{morality}) #{name}\n#{desc}"
end