ruby/trema/dsl/stanza.rb in trema-0.4.6 vs ruby/trema/dsl/stanza.rb in trema-0.4.7

- old
+ new

@@ -22,22 +22,22 @@ module DSL class Stanza attr_reader :name - def initialize name = nil + def initialize(name = nil) @name = name end - def [] attribute + def [](attribute) instance_variable_get "@#{ attribute }".intern end - def fetch attribute - v = self[ attribute ] - raise "#{ attribute } is not set" if v.nil? + def fetch(attribute) + v = self[ attribute] + fail "#{ attribute } is not set" if v.nil? v end end end end