Class: Inform::TagRegistry

Inherits:
Set show all
Defined in:
lib/story_teller/inform/ephemeral/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.



104
105
106
107
# File 'lib/story_teller/inform/ephemeral/tag.rb', line 104

def initialize
  super
  init
end

Instance Method Details

#all_persisted_tagsObject



109
110
111
112
113
114
115
# File 'lib/story_teller/inform/ephemeral/tag.rb', line 109

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

#initObject Also known as: reset



117
118
119
120
121
122
# File 'lib/story_teller/inform/ephemeral/tag.rb', line 117

def init
  self.clear
  self.merge(StoryTeller::Library.declarations.attributes)
  self.merge(all_persisted_tags)
  self
end