Sha256: b60d108f3d5798255c4b1cd5ba53b7d837f24bdbf4f38377ac1efc99550bf962
Contents?: true
Size: 896 Bytes
Versions: 4
Compression:
Stored size: 896 Bytes
Contents
module Intent module Commands class Base attr_reader :identity attr_reader :documents def initialize @identity = strip_classname @documents = ::Intent::Core::Documents.new end def print_help(output) output.puts(File.read(help_txt_path)) end def generate_id Nanoid.generate(size: 8, alphabet: ID_ALPHABET) end private T_CLASS_PREFIX = 'Intent::Commands::' ID_ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' def strip_classname self.class.to_s.sub(T_CLASS_PREFIX, '').downcase end def help_txt_path # TODO: does this work on Windows? "#{__dir__}/../text/#{identity}.help.txt" end def create_noun(type, label, tags) Intent::Core::Noun.new(type, label, tags) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
intent-0.8.1 | lib/intent/commands/base.rb |
intent-0.8.0 | lib/intent/commands/base.rb |
intent-0.7.1 | lib/intent/commands/base.rb |
intent-0.7.0 | lib/intent/commands/base.rb |