Module: Labelizer

Defined in:
lib/labelizer.rb,
lib/labelizer/version.rb,
lib/labelizer/container.rb

Defined Under Namespace

Modules: ClassMethods Classes: Container

Constant Summary collapse

VERSION =
"1.0.0"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
# File 'lib/labelizer.rb', line 8

def self.included(base)
  base.send :extend, ClassMethods
end

Instance Method Details

#labelizedObject



12
13
14
15
16
# File 'lib/labelizer.rb', line 12

def labelized
  @labelized ||= Container.new(self.class.labelized.instance_variable_get(:@keys)){|h,attr|
    h[attr] = self.class.labelized[attr][__send__(attr)]
  }
end