class DTK::Client::Violation::Fix::Result

Constants

Types

Public Class Methods

create(type, *args) click to toggle source
# File lib/violation/fix/result.rb, line 26
def self.create(type, *args)
  case type
    when :error then Error.new(*args)
    else new(type)
  end
end
method_missing(method, *args) click to toggle source
Calls superclass method
# File lib/violation/fix/result.rb, line 39
def self.method_missing(method, *args)
  is_type?(method) ? create(method, *args) : super
end
new(type) click to toggle source
# File lib/violation/fix/result.rb, line 33
def initialize(type)
  @type = type
end
respond_to?(method) click to toggle source
# File lib/violation/fix/result.rb, line 42
def self.respond_to?(method)
  !!is_type?(method) 
end

Private Class Methods

is_type?(method) click to toggle source
# File lib/violation/fix/result.rb, line 59
def self.is_type?(method)
  Types.include?(method) ? method : nil
end

Public Instance Methods

method_missing(method, *args) click to toggle source
Calls superclass method
# File lib/violation/fix/result.rb, line 46
def method_missing(method, *args)
  if type = is_type_with_question_mark?(method)
    type == @type
  else
    super
  end
end
respond_to?(method) click to toggle source
# File lib/violation/fix/result.rb, line 53
def respond_to?(method)
  !!is_type_with_question_mark?(method)
end

Private Instance Methods

is_type_with_question_mark?(method) click to toggle source
# File lib/violation/fix/result.rb, line 63
def is_type_with_question_mark?(method)
  if method.to_s =~ /(^.+)[?]$/
    type = $1.to_sym
    self.class.is_type?(type)
  end
end