Class: Roby::Interface::V2::Protocol::ActionArgument

Inherits:
Struct
  • Object
show all
Defined in:
lib/roby/interface/v2/protocol.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#defaultObject

Returns the value of attribute default

Returns:

  • (Object)

    the current value of default



40
41
42
# File 'lib/roby/interface/v2/protocol.rb', line 40

def default
  @default
end

#docObject

Returns the value of attribute doc

Returns:

  • (Object)

    the current value of doc



40
41
42
# File 'lib/roby/interface/v2/protocol.rb', line 40

def doc
  @doc
end

#exampleObject

Returns the value of attribute example

Returns:

  • (Object)

    the current value of example



40
41
42
# File 'lib/roby/interface/v2/protocol.rb', line 40

def example
  @example
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



40
41
42
# File 'lib/roby/interface/v2/protocol.rb', line 40

def name
  @name
end

#requiredObject

Returns the value of attribute required

Returns:

  • (Object)

    the current value of required



40
41
42
# File 'lib/roby/interface/v2/protocol.rb', line 40

def required
  @required
end

Instance Method Details

#pretty_print(pp) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/roby/interface/v2/protocol.rb', line 47

def pretty_print(pp)
    req_opt =
        if required?
            "[required]"
        else
            "[optional]"
        end

    default = " default=#{default}" unless Protocol.void?(default)

    pp.text "#{name} #{req_opt} #{doc}#{default}"
    unless Protocol.void?(example)
        pp.breakable
        pp.text "  example: #{example}"
    end

    nil
end

#required?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/roby/interface/v2/protocol.rb', line 43

def required?
    required
end