Module: Sod::Models
- Defined in:
- lib/sod/models/action.rb,
lib/sod/models/command.rb
Constant Summary collapse
- Action =
Defines all attributes of an action.
Data.define( :aliases, :argument, :type, :allow, :default, :description, :ancillary ) do using Refinements::Array def initialize aliases: nil, argument: nil, type: nil, allow: nil, default: nil, description: nil, ancillary: nil super end def handle = [Array(aliases).join(", "), argument].tap(&:compact!).join " " def to_a = [*handles, type, allow, description, *ancillary].tap(&:compress!) private def handles = Array(aliases).map { |item| [item, argument].tap(&:compact!).join " " } end
- Command =
Defines all attributes of a command.
Data.define :handle, :description, :ancillary, :actions, :operation do def initialize handle:, description:, actions:, operation:, ancillary: [] super end end