class Scad4r::Notification
Attributes
message[R]
Public Class Methods
new(attributes={})
click to toggle source
# File lib/scad4r/notification.rb, line 23 def initialize(attributes={}) @type, @message = attributes.to_a.pop end
parse(result)
click to toggle source
# File lib/scad4r/notification.rb, line 4 def parse(result) if error = result.fetch(:error, false) Array(new(error: error)) else timings = if real = result.fetch(:real,nil) new(success: real) else nil end Array(result.fetch(:warnings,nil)).map do |warning| new(warning: warning) end + Array(result.fetch(:echos,nil)).map do |echo| new(echo: echo) end + Array(timings) end end
Public Instance Methods
image()
click to toggle source
# File lib/scad4r/notification.rb, line 27 def image case @type when :error :error when :warning :error when :echo, :success :success end end
priority()
click to toggle source
# File lib/scad4r/notification.rb, line 42 def priority case @type when :error 2 when :warning 1 when :echo 1 when :success -1 end end
title()
click to toggle source
# File lib/scad4r/notification.rb, line 38 def title "openscad #{@type.to_s.upcase}" end