Sha256: 73f6ab4958d48aa13ce3c456b6f5b72efa53ab3ddb75443eae2434fa530f9a0a

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

module Rubanok
  # Transformation parameters
  type params = Hash[Symbol | String, untyped]
  # Untyped Hash
  type hash =  Hash[untyped, untyped]
  type field = Symbol
  # Transformation target (we assume that input and output types are the same)
  type input = Object?

  interface _RulesAdding
    def add_rule: (Rule rule) -> void
  end

  class Processor
    extend DSL::Matching::ClassMethods

    extend DSL::Mapping::ClassMethods

    extend _RulesAdding

    UNDEFINED: Object

    self.@rules: Array[Rule]
    self.@fields_set: Set[field]

    def self.superclass: () -> singleton(Processor)

    def self.call: (input, params) -> input
                 | (params) -> input
    def self.rules: () -> Array[Rule]
    def self.fields_set: () -> Set[field]
    def self.project: (params) -> params
    def self.prepare: () { () -> input } -> void

    def initialize: (input) -> void
    def call: (params) -> input

    attr_accessor input: input

    private
    attr_accessor prepared: bool

    alias raw input
    alias prepared? prepared

    def apply_rule!: (Rule rule, params) -> void
    def prepare: () -> input
    def prepare!: () -> void
    def rules: () -> Array[Rule]
  end

  Plane: singleton(Processor)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubanok-0.4.0 sig/rubanok/processor.rbs