Sha256: 99fddc216fa92d3500f4f3e6a145782d84b86a562f6cde81866aa63191acb5a5

Contents?: true

Size: 667 Bytes

Versions: 1

Compression:

Stored size: 667 Bytes

Contents

module Troo
  module CommandHelpers
    module ClassMethods
    end

    def self.included(base)
      base.extend(ClassMethods)
    end

    def error_no_default
      @type = :card if type == :comments
      "Specify an <id> or use 'troo default #{type_str} <id>' " \
      "to set a default #{type_str} first."
    end

    def error_not_found
      @type = :card if type == :comments
      "#{type_capitalize} cannot be found. " + error_no_default
    end

    def type_str
      type.to_s
    end

    def type_capitalize
      type_str.capitalize
    end

    def type_pluralize
      type_str + 's'
    end

    def no_default?
      id.nil?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.8 lib/troo/helpers/command_helpers.rb