Class: Wowr::Classes::Buff
- Inherits:
-
Object
- Object
- Wowr::Classes::Buff
- Defined in:
- lib/wowr/character.rb
Overview
A buff TODO: Code duplication, see basic Item class. Make extend Icon class?
Constant Summary collapse
- @@icon_url_base =
'images/icons/'
- @@icon_sizes =
{:large => ['64x64', 'jpg'], :medium => ['43x43', 'png'], :small => ['21x21', 'png']}
Instance Attribute Summary collapse
-
#effect ⇒ Object
readonly
Returns the value of attribute effect.
-
#icon_base ⇒ Object
readonly
Returns the value of attribute icon_base.
-
#name ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#icon(size = :medium) ⇒ Object
.
-
#initialize(elem, api = nil) ⇒ Buff
constructor
A new instance of Buff.
Constructor Details
#initialize(elem, api = nil) ⇒ Buff
Returns a new instance of Buff.
689 690 691 692 693 694 695 |
# File 'lib/wowr/character.rb', line 689 def initialize(elem, api = nil) @api = api @name = elem[:name] @effect = elem[:effect] @icon_base = elem[:icon] end |
Instance Attribute Details
#effect ⇒ Object (readonly)
Returns the value of attribute effect.
683 684 685 |
# File 'lib/wowr/character.rb', line 683 def effect @effect end |
#icon_base ⇒ Object (readonly)
Returns the value of attribute icon_base.
683 684 685 |
# File 'lib/wowr/character.rb', line 683 def icon_base @icon_base end |
#name ⇒ Object (readonly) Also known as: to_s
Returns the value of attribute name.
683 684 685 |
# File 'lib/wowr/character.rb', line 683 def name @name end |
Instance Method Details
#icon(size = :medium) ⇒ Object
698 699 700 701 702 703 704 705 706 707 708 709 710 711 |
# File 'lib/wowr/character.rb', line 698 def icon(size = :medium) if !@@icon_sizes.include?(size) raise Wowr::Exceptions::InvalidIconSize.new(@@icon_sizes) end if @api base = @api.base_url else base = 'http://www.wowarmory.com/' end # http://www.wowarmory.com/images/icons/64x64/blahblah.jpg return base + @@icon_url_base + @@icon_sizes[size][0] + '/' + @icon_base + '.' + @@icon_sizes[size][1] end |