Module: Subroutine

Defined in:
lib/subroutine.rb,
lib/subroutine/op.rb,
lib/subroutine/auth.rb,
lib/subroutine/fields.rb,
lib/subroutine/failure.rb,
lib/subroutine/outputs.rb,
lib/subroutine/version.rb,
lib/subroutine/type_caster.rb,
lib/subroutine/association_fields.rb,
lib/subroutine/fields/configuration.rb,
lib/subroutine/outputs/configuration.rb,
lib/subroutine/auth/not_authorized_error.rb,
lib/subroutine/fields/mass_assignment_error.rb,
lib/subroutine/outputs/output_not_set_error.rb,
lib/subroutine/outputs/unknown_output_error.rb,
lib/subroutine/association_fields/configuration.rb,
lib/subroutine/outputs/invalid_output_type_error.rb,
lib/subroutine/auth/authorization_not_declared_error.rb,
lib/subroutine/association_fields/component_configuration.rb,
lib/subroutine/association_fields/association_type_mismatch_error.rb

Defined Under Namespace

Modules: AssociationFields, Auth, Fields, Outputs, TypeCaster Classes: Failure, Op

Constant Summary collapse

MAJOR =
4
MINOR =
4
PATCH =
0
PRE =
nil
VERSION =
[MAJOR, MINOR, PATCH, PRE].compact.join(".")

Class Method Summary collapse

Class Method Details

.constantize_polymorphic_class_name(class_name) ⇒ Object

Used by polymorphic association fields to resolve the class name to a ruby class



20
21
22
23
24
# File 'lib/subroutine.rb', line 20

def self.constantize_polymorphic_class_name(class_name)
  return @constantize_polymorphic_class_name.call(class_name) if defined?(@constantize_polymorphic_class_name)

  class_name.camelize.constantize
end

.constantize_polymorphic_class_name=(callable) ⇒ Object

When you need to customize how a polymorphic class name is resolved, you can set this callable/lambda/proc



27
28
29
# File 'lib/subroutine.rb', line 27

def self.constantize_polymorphic_class_name=(callable)
  @constantize_polymorphic_class_name = callable
end

.include_defaults_in_params=(bool) ⇒ Object



31
32
33
# File 'lib/subroutine.rb', line 31

def self.include_defaults_in_params=(bool)
  @include_defaults_in_params = !!bool
end

.include_defaults_in_params?Boolean

Returns:

  • (Boolean)


35
36
37
38
39
# File 'lib/subroutine.rb', line 35

def self.include_defaults_in_params?
  return !!@include_defaults_in_params if defined?(@instance_defaults_in_params)

  false
end

.inheritable_field_optionsObject



45
46
47
# File 'lib/subroutine.rb', line 45

def self.inheritable_field_options
  @inheritable_field_options ||= %i[mass_assignable field_reader field_writer groups aka]
end

.inheritable_field_options=(opts) ⇒ Object



41
42
43
# File 'lib/subroutine.rb', line 41

def self.inheritable_field_options=(opts)
  @inheritable_field_options = opts.map(&:to_sym)
end

.preserve_time_precision=(bool) ⇒ Object



49
50
51
# File 'lib/subroutine.rb', line 49

def self.preserve_time_precision=(bool)
  @preserve_time_precision = !!bool
end

.preserve_time_precision?Boolean

Returns:

  • (Boolean)


53
54
55
56
57
# File 'lib/subroutine.rb', line 53

def self.preserve_time_precision?
  return !!@preserve_time_precision if defined?(@preserve_time_precision)

  false
end