Module: Dry::Ability::T

Extended by:
Types::BuilderMethods
Defined in:
lib/dry/ability/t.rb

Overview

T is for Types

Constant Summary collapse

ArrayWrap =
Array.method(:wrap)
CoercKey =
Types['string'] << method(:Key)
Actions =
WrappedArray(Types['params.symbol'])
Subjects =
WrappedArray(CoercKey)
Hash =
Types['hash']
ActionOrSubject =
Types['symbol'].enum(:action, :subject)
RulesMapping =
Hash.map(CoercKey, Subjects)
Callable =
Interface(:call)
Queriable =
Interface(:where)

Class Method Summary collapse

Class Method Details

.[](*args, &block) ⇒ Object



11
12
13
# File 'lib/dry/ability/t.rb', line 11

def self.[](*args, &block)
  Types[*args, &block]
end

.Key(input) ⇒ Object



15
16
17
18
19
20
# File 'lib/dry/ability/t.rb', line 15

def self.Key(input)
  case input
  when String, Symbol, Module, Class; input.to_s
  else Key(input.class)
  end
end

.WrappedArray(type) ⇒ Object



22
23
24
# File 'lib/dry/ability/t.rb', line 22

def self.WrappedArray(type)
  Array(type) << ArrayWrap
end