class ActiveOopish::RSpecHelper::ValidationTarget

Public Class Methods

new(attributes = {}) click to toggle source
# File lib/activeoopish/rspec_helper.rb, line 38
def initialize(attributes = {})
  @attributes = attributes
end

Public Instance Methods

read_attribute_for_validation(key) click to toggle source
# File lib/activeoopish/rspec_helper.rb, line 42
def read_attribute_for_validation(key)
  @attributes[key.to_sym]
end

Private Instance Methods

method_missing(name, *args) click to toggle source
# File lib/activeoopish/rspec_helper.rb, line 52
def method_missing(name, *args)
  if name.to_s.end_with?('=')
    name = remove_trailing_equal(name)
    @attributes[name] = args.first
  elsif @attributes.include?(name)
    read_attribute_for_validation(name)
  end
end
remove_trailing_equal(string) click to toggle source
# File lib/activeoopish/rspec_helper.rb, line 48
def remove_trailing_equal(string)
  string[0...-1].to_sym
end