Sha256: 4f7fff8fb3a5c26b1bed1dc61bf9c3a9080e08337930a6e03c5933654f342c25

Contents?: true

Size: 702 Bytes

Versions: 4

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true

module Howzit
  # Task object
  class Task
    attr_reader :type, :title, :action, :parent, :optional, :default

    ##
    ## Initialize a Task object
    ##
    def initialize(params, optional: false, default: true)
      @type = params[:type]
      @title = params[:title]
      @action = params[:action].render_arguments
      @parent = params[:parent] || nil
      @optional = optional
      @default = default
    end

    def inspect
      %(<#Howzit::Task @type=:#{@type} @title="#{@title}" @block?=#{@action.split(/\n/).count > 1}>)
    end

    def to_s
      @title
    end

    def to_list
      "    * #{@type}: #{@title.preserve_escapes}"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
howzit-2.0.14 lib/howzit/task.rb
howzit-2.0.13 lib/howzit/task.rb
howzit-2.0.12 lib/howzit/task.rb
howzit-2.0.11 lib/howzit/task.rb