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



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

def name
  @name
end

Class Method Details

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

Yields:

  • (_self)

Yield Parameters:



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

def self.configure
  yield self
end

Instance Method Details

#namespaceObject



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

def namespace
  matches[:namespace]
end

#predicateObject



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

def predicate
  matches[:predicate]
end

#urlObject



54
55
56
57
58
59
60
61
62
63
# File 'lib/calagator/machine_tag.rb', line 54

def url
  return unless machine_tag = urls[namespace]
  return unless url_template = machine_tag[predicate]

  url = format(url_template, value)
  if defunct?
    url = "#{site_root_url}defunct?url=https://web.archive.org/web/#{archive_date}/#{url}"
  end
  url
end

#valueObject



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

def value
  matches[:value]
end

#venue?Boolean

Returns:

  • (Boolean)


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

def venue?
  venue_predicates.include? predicate
end