Sha256: 2f75f481a91b62dda9799932905ba187868df47039a0616a46a825fd21f3d215

Contents?: true

Size: 811 Bytes

Versions: 4

Compression:

Stored size: 811 Bytes

Contents

module CLIUtils
  # The generic base class for a Pref
  # Action.
  class PrefAction
    include Messaging

    # Holds the parameters that apply to
    # this Action.
    # @!attribute parameters
    # @return [Hash]
    attr_accessor :parameters

    # Holds a reference to the pref that
    # is implementing this Action.
    # @!attribute pref
    # @return [Pref]
    attr_accessor :pref

    # Runs the Action. Note that the
    # method implemented here will throw
    # an exception by default, meaning that
    # the user's subclass *needs* to
    # implement it.
    # @parameter [Hash] parameters
    # @raise [StandardError] if the subclass
    #   doesn't implement this method.
    # @return [void]
    def run
      fail "`run` method not implemented on caller: #{ self.class }"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cliutils-2.0.3 lib/cliutils/prefs/pref_actions/pref_action.rb
cliutils-2.0.2 lib/cliutils/prefs/pref_actions/pref_action.rb
cliutils-2.0.1 lib/cliutils/prefs/pref_actions/pref_action.rb
cliutils-2.0.0 lib/cliutils/prefs/pref_actions/pref_action.rb