Class: Hashtags::ResourceType
- Inherits:
-
Base
- Object
- Struct
- Base
- Hashtags::ResourceType
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_key ⇒ Object
42
43
44
|
# File 'lib/hashtags/resource_type.rb', line 42
def self.cache_key
resource_classes.map(&:resource_name)
end
|
.match_index ⇒ Object
24
25
26
|
# File 'lib/hashtags/resource_type.rb', line 24
def self.match_index
2
end
|
.match_regexp ⇒ Object
20
21
22
|
# File 'lib/hashtags/resource_type.rb', line 20
def self.match_regexp
/(#{trigger})(\w*)\z/
end
|
.regexp ⇒ Object
9
10
11
|
# File 'lib/hashtags/resource_type.rb', line 9
def self.regexp
/#{trigger}(.+?)\b/i
end
|
.replace ⇒ Object
28
29
30
|
# File 'lib/hashtags/resource_type.rb', line 28
def self.replace
'$1{{ this }}:'
end
|
.resource_classes ⇒ Object
13
14
15
|
# File 'lib/hashtags/resource_type.rb', line 13
def self.resource_classes
Resource.descendants
end
|
.template ⇒ Object
32
33
34
|
# File 'lib/hashtags/resource_type.rb', line 32
def self.template
'{{ this }}'
end
|
.trigger ⇒ Object
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
|