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.



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

def initialize
  super
  init
end

Instance Method Details

#all_persisted_tagsObject



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

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



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

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