Class: Micro::Struct::Factory::Members::ToEval

Inherits:
Struct
  • Object
show all
Defined in:
lib/micro/struct/factory/members.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionalObject

Returns the value of attribute optional

Returns:

  • (Object)

    the current value of optional



18
19
20
# File 'lib/micro/struct/factory/members.rb', line 18

def optional
  @optional
end

#requiredObject

Returns the value of attribute required

Returns:

  • (Object)

    the current value of required



18
19
20
# File 'lib/micro/struct/factory/members.rb', line 18

def required
  @required
end

#required_and_optionalObject

Returns the value of attribute required_and_optional

Returns:

  • (Object)

    the current value of required_and_optional



18
19
20
# File 'lib/micro/struct/factory/members.rb', line 18

def required_and_optional
  @required_and_optional
end

Instance Method Details

#keyword_argsObject



19
20
21
22
23
24
# File 'lib/micro/struct/factory/members.rb', line 19

def keyword_args
  required_kargs = "#{required.join(':, ')}#{':' unless required.empty?}"
  optional_kargs = "#{optional.join(': nil, ')}#{': nil' unless optional.empty?}"

  [required_kargs, optional_kargs].reject(&:empty?).join(', ')
end

#positional_argsObject



26
27
28
# File 'lib/micro/struct/factory/members.rb', line 26

def positional_args
  required_and_optional.join(', ')
end