Class: Termtter::Status
- Inherits:
-
Object
- Object
- Termtter::Status
- Defined in:
- lib/plugin/bomb.rb,
lib/filter/yhara.rb,
lib/plugin/group.rb,
lib/plugin/keyword.rb,
lib/termtter/status.rb
Class Method Summary collapse
-
.english?(message) ⇒ Boolean
- english?
-
String -> Boolean.
Instance Method Summary collapse
- #bomb? ⇒ Boolean
- #english? ⇒ Boolean
- #eql?(other) ⇒ Boolean
- #has_keyword? ⇒ Boolean (also: #has_keyword)
- #hash ⇒ Object
- #is_member?(group = nil) ⇒ Boolean
- #yharian? ⇒ Boolean
Class Method Details
.english?(message) ⇒ Boolean
- english?
-
String -> Boolean
21 22 23 |
# File 'lib/termtter/status.rb', line 21 def self.english?() /[一-龠]+|[ぁ-ん]+|[ァ-ヴー]+|[a-zA-Z0-9]+/ !~ end |
Instance Method Details
#bomb? ⇒ Boolean
5 6 7 |
# File 'lib/plugin/bomb.rb', line 5 def bomb? /爆発|bomb/ =~ self.text end |
#english? ⇒ Boolean
16 17 18 |
# File 'lib/termtter/status.rb', line 16 def english? self.class.english?(self.text) end |
#eql?(other) ⇒ Boolean
13 |
# File 'lib/termtter/status.rb', line 13 def eql?(other); self.id == other.id end |
#has_keyword? ⇒ Boolean Also known as: has_keyword
7 8 9 |
# File 'lib/plugin/keyword.rb', line 7 def has_keyword? configatron.plugins.keyword.keywords.find { |k| k === self.text } end |
#hash ⇒ Object
14 |
# File 'lib/termtter/status.rb', line 14 def hash; self.id end |
#is_member?(group = nil) ⇒ Boolean
5 6 7 8 9 10 11 |
# File 'lib/plugin/group.rb', line 5 def is_member?(group = nil) if group configatron.plugins.group.groups[group].include? self.user_screen_name else configatron.plugins.group.groups.values.flatten.include? self.user_screen_name end end |
#yharian? ⇒ Boolean
6 7 8 |
# File 'lib/filter/yhara.rb', line 6 def yharian? self.text =~ /^(?:\s|(y\s)|(?:hara\s))+\s*(?:y|(?:hara))(?:\?|!|\.)?\s*$/ end |