Sha256: 23540c6d7b1b8c8f4e64413bb99bd78856a6f12dd662ae9bcf07d2a0b1f2f43f
Contents?: true
Size: 433 Bytes
Versions: 12
Compression:
Stored size: 433 Bytes
Contents
module HumanAttributes class MethodBuilder include HumanAttributes::Config attr_reader :model_class def initialize(model_class) @model_class = model_class end def build(formatter) model_class.send(:define_method, formatter.method_name) do value = send(formatter.attribute) || formatter.default formatter.apply(self, value) end formatter.method_name end end end
Version data entries
12 entries across 12 versions & 1 rubygems