Class: Hashtags::User
- Inherits:
-
Base
- Object
- Struct
- Base
- Hashtags::User
show all
- Defined in:
- lib/hashtags/user.rb
Instance Attribute Summary
Attributes inherited from Base
#str
Class Method Summary
collapse
Methods inherited from Base
descendants, json_for_query, json_regexp, match_template, path, resource_classes, strategy, to_hashtag, #to_hashtag, to_markup, #to_markup, user_classes, values, variable_classes
Class Method Details
.cache_key ⇒ Object
override for custom cache_key
15
16
17
|
# File 'lib/hashtags/user.rb', line 15
def self.cache_key
resource_class.cache_key
end
|
.help_values ⇒ Object
39
40
41
|
# File 'lib/hashtags/user.rb', line 39
def self.help_values
[resource_name]
end
|
.match_index ⇒ Object
50
51
52
|
# File 'lib/hashtags/user.rb', line 50
def self.match_index
2
end
|
.match_regexp ⇒ Object
46
47
48
|
# File 'lib/hashtags/user.rb', line 46
def self.match_regexp
/(#{Regexp.escape(trigger)})(\w{1,})\z/
end
|
.regexp ⇒ Object
35
36
37
|
# File 'lib/hashtags/user.rb', line 35
def self.regexp
/#{Regexp.escape(trigger)}(\w+)/i
end
|
.replace ⇒ Object
54
55
56
|
# File 'lib/hashtags/user.rb', line 54
def self.replace
"#{trigger}{{ #{tag_attribute} }}"
end
|
.resource_class ⇒ Object
implement as user class in your application
6
7
8
|
# File 'lib/hashtags/user.rb', line 6
def self.resource_class
raise NotImplemented
end
|
.resource_name ⇒ Object
10
11
12
|
# File 'lib/hashtags/user.rb', line 10
def self.resource_name
resource_class.to_s.demodulize.underscore
end
|
.result_attribute ⇒ Object
the tags will be replaced by this attribute (for example :full_name)
31
32
33
|
# File 'lib/hashtags/user.rb', line 31
def self.result_attribute
raise NotImplemented
end
|
.tag_attribute ⇒ Object
name of attribute to be used in the tag @<tag_attribute> (for example :username)
25
26
27
|
# File 'lib/hashtags/user.rb', line 25
def self.tag_attribute
raise NotImplemented
end
|
.template ⇒ Object
58
59
60
|
# File 'lib/hashtags/user.rb', line 58
def self.template
"{{ #{tag_attribute} }}"
end
|
.trigger ⇒ Object
19
20
21
|
# File 'lib/hashtags/user.rb', line 19
def self.trigger
'@'
end
|