Inversion::

MethodUtilities module

A collection of methods for declaring other methods.

class MyClass
    include Inversion::MethodUtilities

    singleton_attr_accessor :types
end

MyClass.types = [ :pheno, :proto, :stereo ]

Public Instance Methods

singleton_attr_accessor( *symbols )

Creates readers and writers that allow assignment to the attributes of the singleton of the declaring object that correspond to the specified ‘symbols`.

# File lib/inversion/mixins.rb, line 216
def singleton_attr_accessor( *symbols )
        symbols.each do |sym|
                singleton_class.__send__( :attr_accessor, sym )
        end
end
singleton_attr_reader( *symbols )

Creates instance variables and corresponding methods that return their values for each of the specified ‘symbols` in the singleton of the declaring object (e.g., class instance variables and methods if declared in a Class).

# File lib/inversion/mixins.rb, line 199
def singleton_attr_reader( *symbols )
        symbols.each do |sym|
                singleton_class.__send__( :attr_reader, sym )
        end
end
singleton_attr_writer( *symbols )

Creates methods that allow assignment to the attributes of the singleton of the declaring object that correspond to the specified ‘symbols`.

# File lib/inversion/mixins.rb, line 207
def singleton_attr_writer( *symbols )
        symbols.each do |sym|
                singleton_class.__send__( :attr_writer, sym )
        end
end