Class: Inform::TagRegistry

Inherits:
Set show all
Defined in:
lib/runtime/tag.rb

Overview

The TagRegistry class

Constant Summary collapse

SINGLETON =
Struct.new(:memo).new

Instance Method Summary collapse

Methods inherited from Set

#ruby_to_s, #to_s

Constructor Details

#initializeTagRegistry

Returns a new instance of TagRegistry.



120
121
122
123
# File 'lib/runtime/tag.rb', line 120

def initialize
  super
  init
end

Instance Method Details

#all_persisted_tagsObject



125
126
127
128
129
130
131
# File 'lib/runtime/tag.rb', line 125

def all_persisted_tags
  return [] unless Inform::Tag.respond_to?(:map)
  Inform::Tag.map { |a| a.name.to_sym }
rescue Sequel::DatabaseError => e
  log.warn e.message
  return []
end

#initObject Also known as: reset



133
134
135
136
137
138
# File 'lib/runtime/tag.rb', line 133

def init
  self.clear
  self.merge(Inform::Library::DeclaredAttributes.memo)
  self.merge(all_persisted_tags)
  self
end