Sha256: 61802550f5b0783f031683a200dd997c8f1d6df13a59480f9b718124a99e526f

Contents?: true

Size: 502 Bytes

Versions: 1

Compression:

Stored size: 502 Bytes

Contents

module Bullit
  class Task
    attr_accessor :text, :complete

    def initialize(text:, complete: false, created_at: Time.now)
      @text = text
      @complete = complete
      @created_at = created_at
    end

    def to_h
      {
        text: text,
        complete: complete,
        created_at: Time.now.to_s
      }
    end

    def mark_as_complete
      @complete = true
      to_h
    end
  end
end

class Hash
  def to_task
    Bullit::Task.new(self)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bullit-0.1.3 lib/bullit/task.rb