Class: Geoblacklight::Relation::RelationResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/geoblacklight/relation/relation_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, repository) ⇒ RelationResponse

Returns a new instance of RelationResponse.



7
8
9
10
11
# File 'lib/geoblacklight/relation/relation_response.rb', line 7

def initialize(id, repository)
  @link_id = id
  @search_id = RSolr.solr_escape(id)
  @repository = repository
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



13
14
15
16
17
18
19
20
21
# File 'lib/geoblacklight/relation/relation_response.rb', line 13

def method_missing(method, *args, &block)
  if Settings.RELATIONSHIPS_SHOWN.key?(method)
    field = Settings.RELATIONSHIPS_SHOWN[method].field
    query_type = query_type(Settings.RELATIONSHIPS_SHOWN[method])
    @results = query_type.new(@search_id, field, @repository).results
  else
    super
  end
end

Instance Attribute Details

Returns the value of attribute link_id.



6
7
8
# File 'lib/geoblacklight/relation/relation_response.rb', line 6

def link_id
  @link_id
end

#search_idObject (readonly)

Returns the value of attribute search_id.



6
7
8
# File 'lib/geoblacklight/relation/relation_response.rb', line 6

def search_id
  @search_id
end

Instance Method Details

#respond_to_missing?(method_name, *args) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/geoblacklight/relation/relation_response.rb', line 23

def respond_to_missing?(method_name, *args)
  Settings.RELATIONSHIPS_SHOWN.key?(method_name) or super
end