Sha256: 64a8e91c83e4aa502807a353a77e4665456ca415bc485af18f0fa25ce17226cb
Contents?: true
Size: 836 Bytes
Versions: 16
Compression:
Stored size: 836 Bytes
Contents
require 'time' module TaskManager class Task attr_accessor :name, :score, :id, :created_at, :started_at, :finished_at def initialize(name = nil, score = nil) @name = name @score = score end def self.new_from_node(node) task = Task.new task.id = node['id'] task.name = node['name'] task.score = node['score'] task.created_at = parse_time(node['created_at']) task.started_at = parse_time(node['started_at']) task.finished_at = parse_time(node['finished_at']) task end private def self.parse_time(string) if string && !string.empty? Time.parse(string) else nil end end end end
Version data entries
16 entries across 16 versions & 1 rubygems