Sha256: d4d730fd8b128da12183f529bc2e4686e58f1400655561d87d1e653af7603742
Contents?: true
Size: 1.6 KB
Versions: 1
Compression:
Stored size: 1.6 KB
Contents
class Item extend Findable attr_accessor :name, :url, :effect, :id, :data @@all = [] @@tag = "item" @@limit = 954 def initialize(name, url) self.name = name self.url = url self.data = JSON.parse(RestClient.get(url)) self.set_attributes @@all << self end def self.all @@all end def self.tag @@tag end def self.limit @@limit end def tag @@tag end def set_attributes self.set_effect self.set_id end def set_effect self.effect = self.data["effect_entries"][0]["effect"] end def set_id self.id = self.data["id"] end def print_name puts "Name: #{self.name.capitalize.light_green}" end def get_colored_name self.name.capitalize.light_green end def print_effect puts "Effect: #{self.effect}" end def print_all puts "---------------------------------------------------------" puts " Dexter++ : Item ".light_green puts "---------------------------------------------------------" self.print_name puts "" self.print_effect puts "---------------------------------------------------------" end def self.print_all self.all.each{|item| item.print_all} end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dexter_plusplus-0.2.0 | lib/dexter_plusplus/item.rb |