Class: Sod::Models::Action

Inherits:
Data
  • Object
show all
Defined in:
lib/sod/models/action.rb

Overview

Defines all attributes of an action.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(aliases: nil, argument: nil, type: nil, allow: nil, default: nil, description: nil, ancillary: nil) ⇒ Action

Returns a new instance of Action.



19
20
21
22
23
24
25
26
27
# File 'lib/sod/models/action.rb', line 19

def initialize aliases: nil,
               argument: nil,
               type: nil,
               allow: nil,
               default: nil,
               description: nil,
               ancillary: nil
  super
end

Instance Attribute Details

#aliasesObject (readonly)

Returns the value of attribute aliases

Returns:

  • (Object)

    the current value of aliases



8
9
10
# File 'lib/sod/models/action.rb', line 8

def aliases
  @aliases
end

#allowObject (readonly)

Returns the value of attribute allow

Returns:

  • (Object)

    the current value of allow



8
9
10
# File 'lib/sod/models/action.rb', line 8

def allow
  @allow
end

#ancillaryObject (readonly)

Returns the value of attribute ancillary

Returns:

  • (Object)

    the current value of ancillary



8
9
10
# File 'lib/sod/models/action.rb', line 8

def ancillary
  @ancillary
end

#argumentObject (readonly)

Returns the value of attribute argument

Returns:

  • (Object)

    the current value of argument



8
9
10
# File 'lib/sod/models/action.rb', line 8

def argument
  @argument
end

#defaultObject (readonly)

Returns the value of attribute default

Returns:

  • (Object)

    the current value of default



8
9
10
# File 'lib/sod/models/action.rb', line 8

def default
  @default
end

#descriptionObject (readonly)

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



8
9
10
# File 'lib/sod/models/action.rb', line 8

def description
  @description
end

#typeObject (readonly)

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



8
9
10
# File 'lib/sod/models/action.rb', line 8

def type
  @type
end

Instance Method Details

#handleObject



29
# File 'lib/sod/models/action.rb', line 29

def handle = [Array(aliases).join(", "), argument].tap(&:compact!).join " "

#to_aObject



31
# File 'lib/sod/models/action.rb', line 31

def to_a = [*handles, type, allow, description, *ancillary].tap(&:compress!)