Module: Micro::Attributes::Features

Extended by:
Features
Included in:
Features
Defined in:
lib/micro/attributes/features.rb,
lib/micro/attributes/features/diff.rb,
lib/micro/attributes/features/initialize.rb,
lib/micro/attributes/features/initialize/strict.rb,
lib/micro/attributes/features/activemodel_validations.rb

Defined Under Namespace

Modules: ActiveModelValidations, Diff, Initialize

Constant Summary collapse

STRICT_INITIALIZE =
'strict_initialize'.freeze
ALL_VISIBLE =
[
  DIFF = 'diff'.freeze,
  INITIALIZE = 'initialize'.freeze,
  ACTIVEMODEL_VALIDATIONS = 'activemodel_validations'.freeze
].sort.freeze
ALL =
(ALL_VISIBLE + [STRICT_INITIALIZE]).sort.freeze

Instance Method Summary collapse

Instance Method Details

#allObject



43
44
45
# File 'lib/micro/attributes/features.rb', line 43

def all
  @all ||= self.with(ALL)
end

#with(args) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/micro/attributes/features.rb', line 47

def with(args)
  valid_names!(args) do |names|
    delete_initialize_if_has_strict_initialize(names)

    OPTIONS.fetch(names.sort.join(':'))
  end
end

#without(args) ⇒ Object



55
56
57
58
59
60
# File 'lib/micro/attributes/features.rb', line 55

def without(args)
  valid_names!(args) do |names_to_exclude|
    names = except_options(names_to_exclude)
    names.empty? ? ::Micro::Attributes : self.with(names)
  end
end