Sha256: 86e22b46a739551fc53ea2da871f7e68d9be2ed134b6d3331e713d8c9f425abb

Contents?: true

Size: 637 Bytes

Versions: 4

Compression:

Stored size: 637 Bytes

Contents

module NetSuite
  module FieldSupport
    include AttributeSupport

    def self.included(base)
      base.send(:extend, ClassMethods)
    end

    module ClassMethods

      def fields(*args)
        if args.empty?
           @fields ||= Set.new
        else
          args.each do |arg|
            field arg
          end
        end
      end

      def field(name)
        name_sym = name.to_sym
        fields << name_sym
        define_method(name_sym) do
          attributes[name_sym]
        end

        define_method("#{name_sym}=") do |value|
          attributes[name_sym] = value
        end
      end

    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
netsuite-0.0.10 lib/netsuite/field_support.rb
netsuite-0.0.9 lib/netsuite/field_support.rb
netsuite-0.0.8 lib/netsuite/field_support.rb
netsuite-0.0.7 lib/netsuite/field_support.rb