Class: EasyTag::File

Inherits:
Base
  • Object
show all
Defined in:
lib/easytag/file.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#interface

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

build_proxy_methods, #proxy_getter

Constructor Details

#initialize(file) ⇒ File

Returns a new instance of File.



9
10
11
12
13
14
15
16
17
18
# File 'lib/easytag/file.rb', line 9

def initialize(file)
  @file = file

  if audio_interface_class.nil?
    raise EasyTagFileUnsupportedError,
      "Couldn't determine which interface to use"
  end

  @interface = audio_interface_class.new(file)
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



7
8
9
# File 'lib/easytag/file.rb', line 7

def file
  @file
end

Class Method Details

.open(file) ⇒ Object

block interface



21
22
23
24
25
26
27
28
# File 'lib/easytag/file.rb', line 21

def self.open(file)
  interface = self.new(file)
  begin
    yield interface if block_given?
  ensure
    interface.close if interface.respond_to?(:close)
  end
end