lib/howzit/task.rb in howzit-2.0.10 vs lib/howzit/task.rb in howzit-2.0.11

- old
+ new

@@ -3,15 +3,18 @@ module Howzit # Task object class Task attr_reader :type, :title, :action, :parent, :optional, :default - def initialize(type, title, action, parent = nil, optional: false, default: true) - @type = type - @title = title - @action = action.render_arguments - @parent = parent + ## + ## 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 @@ -21,9 +24,9 @@ def to_s @title end def to_list - " * #{@type}: #{@title.gsub(/\\n/, '\​n')}" + " * #{@type}: #{@title.preserve_escapes}" end end end