Class: EasyTag::Base

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

Direct Known Subclasses

File, Interfaces::MP3, Interfaces::MP4

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#interfaceObject (readonly)

Returns the value of attribute interface.



9
10
11
# File 'lib/easytag/base.rb', line 9

def interface
  @interface
end

Class Method Details

.build_proxy_methods(iface) ⇒ Object



11
12
13
14
15
16
# File 'lib/easytag/base.rb', line 11

def self.build_proxy_methods(iface)
  # generate dynamic getters
  (iface.instance_methods - Object.instance_methods).each do |m|
    define_method(m) { proxy_getter(m) }
  end
end

Instance Method Details

#proxy_getter(m) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/easytag/base.rb', line 18

def proxy_getter(m)
  unless @interface.respond_to?(m)
    warn "#{@interface.class} doesn't support method #{m}"
  end
  
  @interface.send(m)
end