Sha256: b82458f8c434c98897db38f203c5a38d4062d8c5aa4e9e94ba21e54850670507

Contents?: true

Size: 1005 Bytes

Versions: 2

Compression:

Stored size: 1005 Bytes

Contents

# coding:utf-8
# License:: Ruby
# Author:: Guillaume Pierronnet (mailto:moumar_AT__rubyforge_DOT_org)
# Website:: http://ruby-mp3info.rubyforge.org/

class Mp3Info
  module HashKeys #:nodoc:
    ### lets you specify hash["key"] as hash.key
    ### this came from CodingInRuby on RubyGarden
    ### http://www.rubygarden.org/ruby?CodingInRuby
    def method_missing(meth,*args)
      m = meth.id2name
      if /=$/ =~ m
        self[m.chop] = (args.length<2 ? args[0] : args)
      else
        self[m]
      end
    end
  end

  class ::String
    if RUBY_VERSION < "1.9.0"
      alias getbyte []
    else
      def getbyte(i)
        self[i].ord unless self[i].nil?
      end
    end
  end

  module Mp3FileMethods #:nodoc:
    if RUBY_VERSION < "1.9.0"
      def getbyte
        getc
      end
    end

    def get32bits
      (getbyte << 24) + (getbyte << 16) + (getbyte << 8) + getbyte
    end

    def get_syncsafe
      (getbyte << 21) + (getbyte << 14) + (getbyte << 7) + getbyte
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mp3info-0.6.18 lib/mp3info/extension_modules.rb
mp3info-0.6.17 lib/mp3info/extension_modules.rb