mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
19 lines
482 B
Ruby
19 lines
482 B
Ruby
class Matchup
|
|
attr_accessor :w1, :w2, :round, :weight_id, :boutNumber, :w1_name, :w2_name, :bracket_position, :bracket_position_number, :weight_max
|
|
|
|
def to_hash
|
|
hash = {}
|
|
instance_variables.each {|var| hash[var.to_s.delete("@")] = instance_variable_get(var) }
|
|
hash
|
|
end
|
|
|
|
def convert_to_obj(h)
|
|
h.each do |k,v|
|
|
self.class.send(:attr_accessor, k)
|
|
instance_variable_set("@#{k}", v)
|
|
convert_to_obj(v) if v.is_a? Hash
|
|
end
|
|
end
|
|
|
|
|
|
end |