Class: ActsAsMessageable::Rails4

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/acts_as_messageable/rails4.rb

Instance Method Summary collapse

Constructor Details

#initialize(subject) ⇒ Rails4

Returns a new instance of Rails4.



13
14
15
# File 'lib/acts_as_messageable/rails4.rb', line 13

def initialize(subject)
  @subject = subject
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



42
43
44
# File 'lib/acts_as_messageable/rails4.rb', line 42

def method_missing(name, *args)
  T.unsafe(@subject).send(name, *args) || super
end

Instance Method Details

#attr_accessible(*_args) ⇒ Object



21
# File 'lib/acts_as_messageable/rails4.rb', line 21

def attr_accessible(*_args); end

#default_scope(order_by) ⇒ Object



27
28
29
# File 'lib/acts_as_messageable/rails4.rb', line 27

def default_scope(order_by)
  @subject.send(:default_scope) { T.unsafe(self).order(order_by) }
end

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/acts_as_messageable/rails4.rb', line 50

def respond_to_missing?(method_name, include_private = false)
  %w[default_scope scoped attr_accessible].include?(method_name) || super
end

#scopedObject



34
35
36
# File 'lib/acts_as_messageable/rails4.rb', line 34

def scoped
  T.unsafe(@subject).scope
end