class Vizkit::TaskModelItem

Attributes

model[R]

Public Class Methods

new(task, item_type: :label) click to toggle source
Calls superclass method Vizkit::VizkitItem.new
# File lib/vizkit/vizkit_items.rb, line 899
def initialize(task, item_type: :label)
    super()

    @options[:item_type] = item_type

    if item_type == :value
        task.on_reachable do
            begin
                @model = task.to_async.model
                setText @model.name
            rescue
            end
        end
    elsif item_type == :label
        setText "TaskModel"
    else
        raise ArgumentError, "#{item_type} is not a valid value for the item_type option of #{self.class}. Expected either :label or :value"
    end
end