lib/blather/stanza/message.rb in sprsquish-blather-0.4.0 vs lib/blather/stanza/message.rb in sprsquish-blather-0.4.1
- old
+ new
@@ -25,12 +25,10 @@
node.type = type
node.body = body
node
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 :chat, :error, :groupchat, :headline or :normal
def type=(type)
raise ArgumentError, "Invalid Type (#{type}), use: #{VALID_TYPES*' '}" if type && !VALID_TYPES.include?(type.to_sym)
\ No newline at end of file