Module: Emotions::Emotive::ClassMethods

Defined in:
lib/emotions/emotive.rb

Instance Method Summary collapse

Instance Method Details

#define_emotion_methods(emotion) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/emotions/emotive.rb', line 24

def define_emotion_methods(emotion)
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
    def #{emotion}_about
      emotions.where(emotion: #{emotion.to_s.inspect})
    end
    alias #{emotion}_with #{emotion}_about
    alias #{emotion}_over #{emotion}_about
  RUBY
end