lib/ika3/weapons.rb in ika3-0.2.1 vs lib/ika3/weapons.rb in ika3-0.3.0
- old
+ new
@@ -1,15 +1,11 @@
module Ika3
- class Weapon < Hash
- include Hashie::Extensions::MethodAccess
-
+ class Weapon
ATTRIBUTES = [
:name, :sub, :special
].freeze
- attr_accessor :io
-
ATTRIBUTES.each do |attribute|
define_method attribute do
self[attribute]
end
end
@@ -21,10 +17,10 @@
raise "unknown weapon: #{weapon_key}" unless valid?(weapon_key)
@cache ||= {}
unless @cache[weapon_key]
weapon_config = config[weapon_key] || {}
- @cache[weapon_key] = Ika3::Weapon[weapon_config].tap {|weapon| weapon.io = $stdout}
+ @cache[weapon_key] = weapon_config
end
@cache[weapon_key]
end