Sha256: 7785cfa7d15456c962b0900be7476b35dd17487d1fc4508f1b073ab16b9b78e3
Contents?: true
Size: 722 Bytes
Versions: 2
Compression:
Stored size: 722 Bytes
Contents
module Troo module Commands class Default class << self def dispatch(klass, id) new(klass, id).set_default end end def initialize(klass, id) @klass, @id = klass, id end 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.10 | lib/troo/cli/commands/default.rb |
troo-0.0.9 | lib/troo/cli/commands/default.rb |