Module: Types
- Defined in:
- lib/odorico/types.rb
Overview
rubocop:disable Metrics/ModuleLength
Constant Summary collapse
- TrueFalseBool =
True = Bool.constrained(eql: true) False = Bool.constrained(eql: “False”)
Types::Strict::Bool.enum( true => 'True', false => 'False' )
- True =
TrueFalseBool.constrained(eql: 'True')
- False =
TrueFalseBool.constrained(eql: 'False')
- ZeroUmBool =
Types::Strict::Bool.enum( true => '1', false => '0' )
- ZeroBool =
ZeroUmBool.constrained(eql: '0')
- SNBool =
Types::Strict::Bool.enum( true => 'S', false => 'N' )
- NBool =
SNBool.constrained(eql: 'N')
- Date =
Types::Strict::Date.constructor do |value| next nil if value.nil? case value when /\d{8}/ ::Date.new(value[0..3].to_i, value[4..5].to_i, value[6..7].to_i) when /^\d{4}-\d{2}-\d{2}$/ ::Date.parse(value) else # "1991-08-31".to_date ::Date.new(value[6..9].to_i, value[3..4].to_i, value[0..1].to_i) end end
- AnoMesDia =
Types::Strict::String.constructor do |data_nao_formatada| "#{data_nao_formatada[0..3]}-#{data_nao_formatada[4..5]}-#{data_nao_formatada[6..7]}" end
- AnoMes =
Types::Strict::String.constructor do |data_nao_formatada| "#{data_nao_formatada[3..6]}-#{data_nao_formatada[0..1]}" end
- Integer =
Types::Coercible::Integer
- Decimal =
Types::Strict::String.constructor do |value| next nil if value.nil? valor = Types::Coercible::Decimal[value.sub('.', '').sub(',', '.')] format('%#.2f', valor) end
- TipoInscricaoEmpregador =
TIPO_INSCRICAO_EMPREGADOR = %w.freeze TipoInscricaoEmpregador = Types.Values(*TIPO_INSCRICAO_EMPREGADOR)
Types::Strict::Integer.enum( 1 => '1' )
- IndicativoCooperativa =
INDICATIVO_SITUACAO_PJ = %w.freeze IndicativoSituacaoPJ = Types.Values(*INDICATIVO_SITUACAO_PJ)
Types::Strict::Integer.enum( 0 => '0' )
- CLASSIFICACAO_TRIBUTARIA =
%w[01 02 03 04 99].freeze
- ClassificacaoTributaria =
Types.Values(*CLASSIFICACAO_TRIBUTARIA)
- TipoInscricaoEstabelecimento =
Validações do Estabelecimento
Types::Strict::Integer.enum( 1 => '1' )
- ContratacaoPessoaComDeficiencia =
Types::Strict::Integer.enum( 0 => '0', 2 => '2', 9 => '9' )
- TIPO_LOGRADOURO =
Validações Empregado
%w[V].freeze
- TipoLogradouro =
Types.Values(*TIPO_LOGRADOURO)
- TipoAdmissao =
Types::Strict::Integer.enum( 1 => '1', 2 => '2' )
- IndicativoAdmissao =
Types::Strict::Integer.enum( 1 => '1' )
- TipoRegimeJornada =
Types::Strict::Integer.enum( 1 => '1', 2 => '2', 3 => '3', 4 => '4' )
- NaturezaAtividade =
Types::Strict::Integer.enum( 1 => '1', 2 => '2' )
- OpcaoFgts =
Types::Strict::Integer.enum( 1 => '1' )
- UnidadeSalarial =
Types::Strict::Integer.enum( 5 => '5' )
- TipoContrato =
Types::Strict::Integer.enum( 1 => '1', 2 => '2' )
- TipoInscricaoLocalTrabalho =
Types::Strict::Integer.enum( 1 => '1' )
- TIPOS_DE_JORNADA =
{ 1 => '1', 2 => '2', 3 => '3', 9 => '9' }.freeze
- TIPOS_DE_JORNADA_LEIAUTE_SIMPLIFICADO =
{ 2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '6', 7 => '7', 9 => '9' }.freeze
- TipoJornada =
Types::Strict::Integer.enum( TIPOS_DE_JORNADA.merge(TIPOS_DE_JORNADA_LEIAUTE_SIMPLIFICADO) )
- JornadaTempoParcial =
Types::Strict::Integer.enum( 0 => '0', 1 => '1', 2 => '2', 3 => '3' )
- CATEGORIA_TRABALHADOR =
%w[101 103 105 111].freeze
- CategoriaTrabalhador =
Types.Values(*CATEGORIA_TRABALHADOR)
- CATEGORIA_TRABALHADOR_TSV =
%w[701 723 901].freeze
- CategoriaTrabalhadorTsv =
Types.Values(*CATEGORIA_TRABALHADOR_TSV)
- CATEGORIA_TRABALHADOR_TSV_CONTRATUAL =
%w[723].freeze
- CategoriaTrabalhadorTsvContratual =
Types.Values(*CATEGORIA_TRABALHADOR_TSV_CONTRATUAL)
- CAUSAS_DESLIGAMENTO =
%w[01 02 03 04 05 06 07 09 10 14 17 27 33].freeze
- CausasDesligamento =
Types.Values(*CAUSAS_DESLIGAMENTO)
- TIPO_LOTACAO =
Lotações Tributárias
%w[01].freeze
- TipoLotacao =
Types.Values(*TIPO_LOTACAO)
- TipoInscricaoLotacao =
Types::Strict::Integer.enum( 1 => '1' )
- TipoRegimeTrabalhista =
Types::Strict::Integer.enum( 1 => '1' )
- TipoRegimePrevidenciario =
Types::Strict::Integer.enum( 1 => '1' )
- TipoIntervalo =
Horários
Types::Strict::Integer.enum( 1 => '1', 2 => '2' )
- MOTIVOS_AFASTAMENTO_TRABALHADOR =
Afastamentos
%w[01 03 06 15 17 19 20 21 29 33 35 37].freeze
- MotivosAfastamento =
Types.Values(*MOTIVOS_AFASTAMENTO_TRABALHADOR)
Class Method Summary collapse
-
.Values(*values) ⇒ Object
rubocop:disable Naming/MethodName.
Class Method Details
.Values(*values) ⇒ Object
rubocop:disable Naming/MethodName
6 7 8 |
# File 'lib/odorico/types.rb', line 6 def self.Values(*values) # rubocop:disable Naming/MethodName Types::Any.constrained(included_in: values) end |