Class: Module

Inherits:
Object show all
Defined in:
lib/backports/rails/module.rb,
lib/backports/1.8.7/method/name.rb,
lib/backports/2.5.0/module/attr.rb,
lib/backports/2.1.0/module/include.rb,
lib/backports/1.8.7/module/module_exec.rb,
lib/backports/2.5.0/module/attr_reader.rb,
lib/backports/2.5.0/module/attr_writer.rb,
lib/backports/2.5.0/module/alias_method.rb,
lib/backports/2.5.0/module/undef_method.rb,
lib/backports/2.5.0/module/attr_accessor.rb,
lib/backports/2.5.0/module/define_method.rb,
lib/backports/2.5.0/module/remove_method.rb,
lib/backports/2.1.0/module/singleton_class.rb

Instance Method Summary collapse

Instance Method Details

#alias_method_chain(target, feature, &block) ⇒ Object

Standard in rails… See official documentation



7
8
9
# File 'lib/backports/rails/module.rb', line 7

def alias_method_chain(target, feature, &block)
  Backports.alias_method_chain(self, target, feature, &block)
end

#instance_method_with_additional_info(name) ⇒ Object



41
42
43
44
45
46
# File 'lib/backports/1.8.7/method/name.rb', line 41

def instance_method_with_additional_info(name)
  unbound = instance_method_without_additional_info(name)
  unbound.name = name.to_s
  unbound.owner = ancestors.find{|mod| mod.instance_methods(false).include? unbound.name}
  unbound
end

#module_exec(*arg, &block) ⇒ Object



6
7
8
# File 'lib/backports/1.8.7/module/module_exec.rb', line 6

def module_exec(*arg, &block)
  instance_exec(*arg, &block)
end

#singleton_class?Boolean

Returns:

  • (Boolean)


3
4
5
6
# File 'lib/backports/2.1.0/module/singleton_class.rb', line 3

def singleton_class?
  # Hacky...
  inspect.start_with? '#<Class:#'
end