Sha256: 1aa3035eb6ed8d940304aafc094d222ae7026e26e03cb20b2bbd984b6b499481

Contents?: true

Size: 743 Bytes

Versions: 37

Compression:

Stored size: 743 Bytes

Contents

require 'synchronisable/dsl/macro/expression'

module Synchronisable
  module DSL
    module Macro
      # Expression for an attribute definition.
      #
      # @api private
      #
      # @see Synchronisable::DSL::Macro
      # @see Synchronisable::DSL::Expression
      class Attribute < Expression
        def initialize(options)
          @converter = options[:converter]
          super
        end

        def source
          transform(@source)
        end

        def default
          transform(@default)
        end

        protected

        def transform(arg)
          convert(super)
        end

        private

        def convert(arg)
          @converter.try(:call, arg) || arg
        end
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
synchronisable-1.3.1 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.3.0 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.2.7 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.2.6 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.2.5 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.2.4 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.2.3 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.2.2 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.2.1 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.2.0 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.1.9 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.1.8 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.1.7 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.1.6 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.1.5 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.1.4 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.1.3 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.1.2 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.1.1 lib/synchronisable/dsl/macro/attribute.rb
synchronisable-1.1.0 lib/synchronisable/dsl/macro/attribute.rb