Class: Dmm::Iteminfo

Inherits:
Base
  • Object
show all
Defined in:
lib/dmm/iteminfo.rb

Instance Method Summary collapse

Methods inherited from Base

attr_reader, #initialize

Constructor Details

This class inherits a constructor from Dmm::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/dmm/iteminfo.rb', line 5

def method_missing(method, *args)
  if method.to_s =~ /^(series|maker|label)$/
    return nil unless @attrs[method.to_sym]
    @attrs[method.to_sym][:name]
  elsif method.to_s =~ /^(keyword|actress|director|author)$/
    return nil unless @attrs[method.to_sym]
    to_array(method)
  else
    super
  end
end

Instance Method Details

#respond_to?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


18
# File 'lib/dmm/iteminfo.rb', line 18

def respond_to? (method, include_private = false); return true if method.to_s =~ /^(series|maker|label|keyword|actress|director|author)$/; super; end

#respond_to_missing?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


17
# File 'lib/dmm/iteminfo.rb', line 17

def respond_to_missing?(method, include_private = false); return true if method.to_s =~ /^(series|maker|label|keyword|actress|director|author)$/; end