Class: Object

Inherits:
BasicObject
Defined in:
lib/deployable/patch/meta.rb,
lib/deployable/patch/not_nil.rb,
lib/deployable/patch/ensure_array.rb,
lib/deployable/patch/instance_class_variables.rb

Overview

Easier instance variable getters that do the variable naming/symbol for you

Instance Method Summary collapse

Instance Method Details

#__class_ivg(name) ⇒ Object



13
14
15
# File 'lib/deployable/patch/instance_class_variables.rb', line 13

def __class_ivg name
  self.class.__ivg name
end

#__class_ivs(name, value) ⇒ Object



17
18
19
# File 'lib/deployable/patch/instance_class_variables.rb', line 17

def __class_ivs name, value
  self.class.__ivs name, value
end

#__ivg(name) ⇒ Object



5
6
7
# File 'lib/deployable/patch/instance_class_variables.rb', line 5

def __ivg name
  instance_variable_get :"@#{name}" 
end

#__ivs(name, value) ⇒ Object



9
10
11
# File 'lib/deployable/patch/instance_class_variables.rb', line 9

def __ivs name, value
  instance_variable_set :"@#{name}", value
end

#class_def(name, &blk) ⇒ Object

Defines an instance method within a class



15
16
17
# File 'lib/deployable/patch/meta.rb', line 15

def class_def( name, &blk )
  class_eval { define_method name, &blk }
end

#ensure_arrayObject



2
# File 'lib/deployable/patch/ensure_array.rb', line 2

def ensure_array; [self] end

#meta_def(name, &blk) ⇒ Object

Adds methods to a metaclass



10
11
12
# File 'lib/deployable/patch/meta.rb', line 10

def meta_def( name, &blk )
  meta_eval { define_method name, &blk }
end

#meta_eval(&blk) ⇒ Object



7
# File 'lib/deployable/patch/meta.rb', line 7

def meta_eval &blk; metaclass.instance_eval( &blk ); end

#metaclassObject

The hidden singleton lurks behind everyone



6
# File 'lib/deployable/patch/meta.rb', line 6

def metaclass; class << self; self; end; end

#not_nil?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/deployable/patch/not_nil.rb', line 3

def not_nil?
  !nil?
end