class Line::Bot::Event::Base

Public Class Methods

new(src) click to toggle source
Calls superclass method
# File lib/pleiades/core_ext/line/bot/event/base.rb, line 10
def initialize(src)
  @src = Pleiades::Util.define_reader src

  # moduleにする
  # /^[a-z]+_event\?$/
  #  => トークタイプの判定メソッドに反応する。
  #
  # @src.source.type => 'user'
  #   user_event? => true
  #   room_event? => false
  #   hoge_event? => false
  #
  @src.define_singleton_method(:method_missing) do |method, *_|
    return super() unless /^[a-z]+_event\?$/ =~ method

    source.type == method.to_s.split('_').first
  end
  @src.deep_freeze
end

Private Instance Methods

method_missing(method, *_) click to toggle source
Calls superclass method
# File lib/pleiades/core_ext/line/bot/event/base.rb, line 32
def method_missing(method, *_)
  @src.respond_to?(method) || super
  @src.__send__ method
end
respond_to_missing?(method, *_) click to toggle source
Calls superclass method
# File lib/pleiades/core_ext/line/bot/event/base.rb, line 37
def respond_to_missing?(method, *_)
  @src.respond_to?(method) || super
end