Sha256: 581f54e73e8f90cdc76c78d02f2cc1f4e91bb222e55a24e62a1d3c22ed5caa32

Contents?: true

Size: 507 Bytes

Versions: 5

Compression:

Stored size: 507 Bytes

Contents

require 'active_support/concern'

module Ripple
  module AttributeMethods
    module Write
      extend ActiveSupport::Concern

      included do
        attribute_method_suffix "="
      end

      def []=(attr_name, value)
        __send__(:attribute=, attr_name, value)
      end

      private
      def attribute=(attr_name, value)
        if prop = self.class.properties[attr_name]
          value = prop.type_cast(value)
        end
        @attributes[attr_name] = value
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
wyngle-ripple-0.1.0 lib/ripple/attribute_methods/write.rb
better-ripple-1.0.0 lib/ripple/attribute_methods/write.rb
ripple-1.0.0.beta2 lib/ripple/attribute_methods/write.rb
seomoz-ripple-1.0.0.pre lib/ripple/attribute_methods/write.rb
ripple-1.0.0.beta lib/ripple/attribute_methods/write.rb