Class: MetaHari::Spyglass::Base

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

Direct Known Subclasses

AmazonDe

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ Base

Returns a new instance of Base.



12
13
14
# File 'lib/meta_hari/spyglass/base.rb', line 12

def initialize(uri)
  @uri = uri
end

Instance Attribute Details

#uriObject (readonly)

Returns the value of attribute uri.



6
7
8
# File 'lib/meta_hari/spyglass/base.rb', line 6

def uri
  @uri
end

Class Method Details

.suitable?(uri) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/meta_hari/spyglass/base.rb', line 8

def self.suitable?(uri)
  fail StandardError.new, "not implemented for '#{uri.host}'"
end

Instance Method Details

#spyObject



16
17
18
19
20
21
# File 'lib/meta_hari/spyglass/base.rb', line 16

def spy
  OpenStruct.new [
    spy_json_ld,
    spy_microdata
  ].inject({}) { |a, e| a.merge e }
end