Class: StoryKey::Lexicon

Inherits:
Base
  • Object
show all
Defined in:
lib/story_key/lexicon.rb

Instance Method Summary collapse

Methods inherited from Base

call

Instance Method Details

#entriesObject



2
3
4
5
6
# File 'lib/story_key/lexicon.rb', line 2

def entries
  @entries ||= StoryKey::GRAMMAR.values.flatten.uniq.index_with do |part_of_speech|
    import_entries(part_of_speech).sort_by(&:token)
  end
end

#prepositionsObject



8
9
10
# File 'lib/story_key/lexicon.rb', line 8

def prepositions
  @prepositions ||= entries.values.flatten.filter_map(&:preposition).uniq.sort
end

#shaObject



12
13
14
# File 'lib/story_key/lexicon.rb', line 12

def sha
  @sha ||= Digest::SHA256.hexdigest(entries.to_s).first(StoryKey::LEXICON_SHA_SIZE)
end