lib/koine/attributes/adapter/base.rb in koine-attributes-1.2.0 vs lib/koine/attributes/adapter/base.rb in koine-attributes-1.2.1

- old
+ new

@@ -1,13 +1,13 @@ module Koine module Attributes module Adapter class Base - attr_accessor :attribute_name + attr_reader :attribute_name def initialize - @attribute_name = 'annonymous_attribute_name' + with_attribute_name('annonymous_attribute_name') end def coerce(value) return coerce_nil if value.nil? @@ -28,9 +28,14 @@ end def with_default_value(value = nil, &block) @default_value = value @default_value = block if block + self + end + + def with_attribute_name(name) + @attribute_name = name self end private