Module: BinData::AcceptedParametersPlugin

Included in:
Base
Defined in:
lib/bindata/params.rb

Defined Under Namespace

Classes: AcceptedParameters

Instance Method Summary collapse

Instance Method Details

#accepted_parametersObject

:nodoc:



30
31
32
33
34
35
36
# File 'lib/bindata/params.rb', line 30

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

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

Default parameters can be overridden when instantiating a data object.



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

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.



6
7
8
# File 'lib/bindata/params.rb', line 6

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.



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

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.



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

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