Sha256: 3871850216af8e0a90e8acabee4f1866e7872282d3beb9857050f55ff6bee33c

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

module Jot
  module Ruby
    class Operation < SimpleDelegator
      RAW_RESULT_METHODS = %i[isNoOp toJSON apply serialize inspect].freeze
      OPERATION_RESULT_METHODS = %i[simplify drilldown compose rebase].freeze
      DEFAULT_METHODS = RAW_RESULT_METHODS + OPERATION_RESULT_METHODS

      extend Utils::Snippets
      not_implemented *DEFAULT_METHODS

      OPERATION_RESULT_METHODS.each do |method_name|
        define_method method_name do |*args|
          self.class.new(super(*args))
        end
      end

      RAW_RESULT_METHODS.each do |method_name|
        define_method method_name do |*args|
          super(*args)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jot-ruby-0.1.3 lib/jot/ruby/operation.rb