Module: BinData::AcceptedParametersMixin::ClassMethods

Defined in:
lib/bindata/params.rb

Overview

Class methods to mix in to BinData::Base

Instance Method Summary collapse

Instance Method Details

#accepted_parametersObject

:nodoc:



36
37
38
39
40
41
42
43
# File 'lib/bindata/params.rb', line 36

def accepted_parameters #:nodoc:
  unless defined? @accepted_parameters
    ancestor_params = superclass.respond_to?(:accepted_parameters) ?
                        superclass.accepted_parameters : nil
    @accepted_parameters = AcceptedParameters.new(ancestor_params)
  end
  @accepted_parameters
end

#default_parameters(*args) ⇒ Object Also known as: default_parameter

Default parameters can be overridden when instantiating a data object.



22
23
24
# File 'lib/bindata/params.rb', line 22

def default_parameters(*args)
  accepted_parameters.default(*args)
end

#mandatory_parameters(*args) ⇒ Object Also known as: mandatory_parameter

Mandatory parameters must be present when instantiating a data object.



12
13
14
# File 'lib/bindata/params.rb', line 12

def mandatory_parameters(*args)
  accepted_parameters.mandatory(*args)
end

#mutually_exclusive_parameters(*args) ⇒ Object

Mutually exclusive parameters may not all be present when instantiating a data object.



28
29
30
# File 'lib/bindata/params.rb', line 28

def mutually_exclusive_parameters(*args)
  accepted_parameters.mutually_exclusive(*args)
end

#optional_parameters(*args) ⇒ Object Also known as: optional_parameter

Optional parameters may be present when instantiating a data object.



17
18
19
# File 'lib/bindata/params.rb', line 17

def optional_parameters(*args)
  accepted_parameters.optional(*args)
end