Class: Hashtags::ResourceType

Inherits:
Base
  • Object
show all
Defined in:
lib/hashtags/resource_type.rb

Instance Attribute Summary

Attributes inherited from Base

#str

Class Method Summary collapse

Methods inherited from Base

descendants, help_values, json_for_query, json_regexp, match_template, path, strategy, to_hashtag, #to_hashtag, to_markup, #to_markup, user_classes, variable_classes

Class Method Details

.cache_keyObject



42
43
44
# File 'lib/hashtags/resource_type.rb', line 42

def self.cache_key
  resource_classes.map(&:resource_name)
end

.match_indexObject



24
25
26
# File 'lib/hashtags/resource_type.rb', line 24

def self.match_index
  2
end

.match_regexpObject


JS



20
21
22
# File 'lib/hashtags/resource_type.rb', line 20

def self.match_regexp
  /(#{trigger})(\w*)\z/
end

.regexpObject



9
10
11
# File 'lib/hashtags/resource_type.rb', line 9

def self.regexp
  /#{trigger}(.+?)\b/i
end

.replaceObject



28
29
30
# File 'lib/hashtags/resource_type.rb', line 28

def self.replace
  '$1{{ this }}:'
end

.resource_classesObject



13
14
15
# File 'lib/hashtags/resource_type.rb', line 13

def self.resource_classes
  Resource.descendants
end

.templateObject



32
33
34
# File 'lib/hashtags/resource_type.rb', line 32

def self.template
  '{{ this }}'
end

.triggerObject



5
6
7
# File 'lib/hashtags/resource_type.rb', line 5

def self.trigger
  '#'
end

.values(hashtag_classes = Resource.descendants) ⇒ Object




38
39
40
# File 'lib/hashtags/resource_type.rb', line 38

def self.values(hashtag_classes = Resource.descendants)
  (resource_classes & hashtag_classes).map(&:resource_name)
end