Class: Calagator::MachineTag

Inherits:
Struct
  • Object
show all
Defined in:
lib/calagator/machine_tag.rb

Defined Under Namespace

Modules: TagExtensions

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



21
22
23
# File 'lib/calagator/machine_tag.rb', line 21

def name
  @name
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



28
29
30
# File 'lib/calagator/machine_tag.rb', line 28

def self.configure
  yield self
end

Instance Method Details

#namespaceObject



41
42
43
# File 'lib/calagator/machine_tag.rb', line 41

def namespace
  matches[:namespace]
end

#predicateObject



45
46
47
# File 'lib/calagator/machine_tag.rb', line 45

def predicate
  matches[:predicate]
end

#urlObject



53
54
55
56
57
58
59
# File 'lib/calagator/machine_tag.rb', line 53

def url
  return unless machine_tag = urls[namespace]
  return unless url_template = machine_tag[predicate]
  url = sprintf(url_template, value)
  url = "#{site_root_url}defunct?url=https://web.archive.org/web/#{archive_date}/#{url}" if defunct?
  url
end

#valueObject



49
50
51
# File 'lib/calagator/machine_tag.rb', line 49

def value
  matches[:value]
end

#venue?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/calagator/machine_tag.rb', line 37

def venue?
  venue_predicates.include? predicate
end