Sha256: 0ea6d49bd3d803095ef831a0a9b420f70dc67d2300740bb5f700968a39937616

Contents?: true

Size: 291 Bytes

Versions: 2

Compression:

Stored size: 291 Bytes

Contents

module DataForge
  module DSL
    module Attributes

      def define_attribute(name)
        define_method name do |*args|
          return instance_variable_get "@#{name}" if args.count.zero?

          instance_variable_set "@#{name}", args.first
        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
data_forge-0.1.1 lib/data_forge/dsl/attributes.rb
data_forge-0.1 lib/data_forge/dsl/attributes.rb