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.



9
10
11
12
13
# File 'lib/hdeck/card.rb', line 9

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.



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

def ability
  @ability
end

#descObject

Returns the value of attribute desc.



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

def desc
  @desc
end

#moralityObject

Returns the value of attribute morality.



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

def morality
  @morality
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#to_sObject



15
16
17
# File 'lib/hdeck/card.rb', line 15

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