class Card::Content::Chunk::QueryReference

Constants

QUERY_KEYWORDS

Public Class Methods

full_match(content, prefix) click to toggle source
Calls superclass method
# File lib/card/content/chunk/query_reference.rb, line 55
def full_match content, prefix
  # matches cardnames that are not keywords
  # FIXME: would not match cardnames that are keywords
  match, offset = super(content, prefix)
  return if !match || keyword?(match[1])

  [match, offset]
end
keyword?(str) click to toggle source
# File lib/card/content/chunk/query_reference.rb, line 64
def keyword? str
  return unless str

  QUERY_KEYWORDS.include?(str.tr(" ", "_").downcase)
end

Public Instance Methods

inspect() click to toggle source
# File lib/card/content/chunk/query_reference.rb, line 79
def inspect
  "<##{self.class}:n[#{@name}] p[#{@process_chunk}] txt:#{@text}>"
end
interpret(match, _content) click to toggle source
# File lib/card/content/chunk/query_reference.rb, line 71
def interpret match, _content
  @name = match[1]
end
process_chunk() click to toggle source
# File lib/card/content/chunk/query_reference.rb, line 75
def process_chunk
  @process_chunk ||= @text
end
reference_code() click to toggle source
# File lib/card/content/chunk/query_reference.rb, line 88
def reference_code
  "Q" # for "Query"
end
replace_reference(old_name, new_name) click to toggle source
# File lib/card/content/chunk/query_reference.rb, line 83
def replace_reference old_name, new_name
  replace_name_reference old_name, new_name
  @text = "\"#{@name}\""
end