Class: Wowr::Classes::FullItem

Inherits:
Item
  • Object
show all
Defined in:
lib/wowr/item.rb

Overview

Full data from item-info and item-tooltip

Instance Attribute Summary

Attributes inherited from Item

#icon_base, #id, #name

Instance Method Summary collapse

Methods inherited from Item

#icon

Constructor Details

#initialize(info, tooltip, api = nil) ⇒ FullItem

Returns a new instance of FullItem.



56
57
58
59
60
# File 'lib/wowr/item.rb', line 56

def initialize(info, tooltip, api = nil)
	super(info, api)
	@info = ItemInfo.new(info, api)
	@tooltip = ItemTooltip.new(tooltip, api)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/wowr/item.rb', line 62

def method_missing(m, *args)
	begin
		return @info.send(m, *args)
	rescue NoMethodError => e
		begin
			return @tooltip.send(m, *args)
		rescue
			raise NoMethodError.new("undefined method '#{m}' for #{self.class}")
		end
	end
end