Class: Object

Defined in:
lib/plist4r/mixin/ruby_stdlib.rb,
lib/plist4r/mixin/mixlib_config.rb

Instance Methods

Overview

These methods should all be nemespaced to ::Plist4r we don’t want to upset anyone else’s code

Instance Method Details

- (Object) deep_clone

Make a deep copy of an object. Including a deep copy of all the object’s instance data.

Examples:

copy_of_obj = obj.deep_clone

Returns:

  • (Object)

    A new copy of the object



24
# File 'lib/plist4r/mixin/ruby_stdlib.rb', line 24

def deep_clone; Marshal::load(Marshal.dump(self)) end

- (Object) meta_def(name, &blk)



8
9
10
# File 'lib/plist4r/mixin/mixlib_config.rb', line 8

def meta_def name, &blk
  (class << self; self; end).instance_eval { define_method name, &blk }
end

- (String) method_name

The method name my_method => “my_method“

Examples:

def my_method
  method_name
end

Returns:

  • (String)

    The name of the current method



13
14
15
16
17
18
# File 'lib/plist4r/mixin/ruby_stdlib.rb', line 13

def method_name
  if  /`(.*)'/.match(caller.first)
    return $1
  end
  nil
end