Class: Discogs::SearchResult

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, title, uri, summary = nil) ⇒ SearchResult

Returns a new instance of SearchResult.



72
73
74
75
76
77
# File 'lib/search.rb', line 72

def initialize(type, title, uri, summary = nil)
  @type = type
  @title = title
  @uri = uri
  @summary = summary
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object

:nodoc:



79
80
81
82
83
84
# File 'lib/search.rb', line 79

def method_missing(method, *args, &block) #:nodoc:
  type = method.to_s.match(/([a-zA-Z0-9_-]+)\?/)
  # if type.size < 2 the method did not have a question mark at the end
  super if type.size < 2
  @type == type[1].to_s
end

Instance Attribute Details

#summaryObject

Returns the value of attribute summary.



67
68
69
# File 'lib/search.rb', line 67

def summary
  @summary
end

#titleObject

Returns the value of attribute title.



67
68
69
# File 'lib/search.rb', line 67

def title
  @title
end

#typeObject

Returns the value of attribute type.



67
68
69
# File 'lib/search.rb', line 67

def type
  @type
end

#uriObject

Returns the value of attribute uri.



67
68
69
# File 'lib/search.rb', line 67

def uri
  @uri
end

Instance Method Details

#to_sObject

:nodoc:



86
87
88
# File 'lib/search.rb', line 86

def to_s #:nodoc:
  "#{title}"
end