Sha256: 756ef9775de77cf1fa354fb8284b5a1a54245e6ab00696c9d7b7e1813f1a6681
Contents?: true
Size: 861 Bytes
Versions: 2
Compression:
Stored size: 861 Bytes
Contents
module Troo module Commands class Default class << self # @param [] # @param [] # @return [] def dispatch(klass, id) new(klass, id).set_default end end # @param [] # @param [] # @return [] def initialize(klass, id) @klass, @id = klass, id end # @return [] def set_default return success if resource && resource.set_default! error end private attr_reader :id, :klass def success "'#{name}' set as default." end def error "#{type} cannot be found." end def type klass.type.to_s.capitalize end def name resource.decorator.name end def resource @resource ||= klass.retrieve(id) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
troo-0.0.12 | lib/troo/cli/commands/default.rb |
troo-0.0.11 | lib/troo/cli/commands/default.rb |