lib/blather/stanza/presence.rb in blather-0.3.4 vs lib/blather/stanza/presence.rb in blather-0.4.0

- old
+ new

@@ -22,17 +22,15 @@ klass.new.inherit(node) end ## # Ensure element_name is "presence" for all subclasses - def initialize + def self.new super :presence end - VALID_TYPES.each do |valid_type| - define_method("#{valid_type}?") { self.type == valid_type } - end + attribute_helpers_for(:type, VALID_TYPES) ## # Ensures type is one of :unavailable, :subscribe, :subscribed, :unsubscribe, :unsubscribed, :probe or :error def type=(type) raise ArgumentError, "Invalid Type (#{type}), use: #{VALID_TYPES*' '}" if type && !VALID_TYPES.include?(type.to_sym) @@ -40,6 +38,6 @@ end end end #Stanza -end \ No newline at end of file +end