lib/aviglitch/frame.rb in aviglitch-0.1.6 vs lib/aviglitch/frame.rb in aviglitch-0.2.0

- old
+ new

@@ -56,8 +56,28 @@ # Returns if it is an audio frame. def is_audioframe? @id[2, 2] == 'wb' end + ## + # Returns if it is a frame in +frame_type+. + def is? frame_type + return true if frame_type == :all + detection = "is_#{frame_type.to_s.sub(/frames$/, 'frame')}?" + begin + self.send detection + rescue NoMethodError => e + false + end + end + + ## + # Compares its content. + def == other + self.id == other.id && + self.flag == other.flag && + self.data == other.data + end + end end