Method: Bounty.parse

Defined in:
lib/Olib/bounty.rb

.parse(str) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/Olib/bounty.rb', line 59

def Bounty.parse(str)
  type, patt = Bounty.match str
  unless patt
    raise Exception.new "could not match Bounty: #{str}\nplease notify Ondreian"
  else
    bounty = patt.match(str).to_struct
    bounty[:type] = type
    if bounty[:skin] 
      bounty[:skin] = Bounty.singularize(bounty[:skin]) 
    end

    if bounty[:creature]
      bounty[:tags] = Creature.tags(bounty.creature)
    end

    bounty
  end
end