Sha256: ad60d99ab148c7ab9886254506a199c1f76099c222e39e97a3ab43044a200c4e

Contents?: true

Size: 435 Bytes

Versions: 1

Compression:

Stored size: 435 Bytes

Contents

# frozen_string_literal: true

require 'active_builder/version'

module ActiveBuilder
  class Error < StandardError; end

  module ClassMethod
    def attributes(attribute)
      attr_accessor attribute
      method_name = "with_#{attribute}".to_sym
      define_method(method_name) do |value|
        send("#{attribute}=", value)
        self
      end
    end
  end

  def self.included(klass)
    klass.extend ClassMethod
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_builder-1.0.2 lib/active_builder.rb