Class: Object

Inherits:
BasicObject
Includes:
Spec::Expectations::ObjectExpectations, Spec::Mocks::Methods
Defined in:
lib/gems/builder-2.1.2/lib/blankslate.rb,
lib/mack/core_extensions/object.rb,
lib/gems/rspec-1.1.12/lib/spec/mocks/extensions/object.rb,
lib/gems/configatron-2.2.2/lib/configatron/core_ext/object.rb,
lib/gems/rspec-1.1.12/lib/spec/expectations/extensions/object.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Spec::Expectations::ObjectExpectations

#should, #should_not

Methods included from Spec::Mocks::Methods

#as_null_object, #null_object?, #received_message?, #rspec_reset, #rspec_verify, #should_not_receive, #should_receive, #stub!

Class Method Details

.blank_slate_method_addedObject



79
# File 'lib/gems/builder-2.1.2/lib/blankslate.rb', line 79

alias_method :blank_slate_method_added, :method_added

.find_hidden_method(name) ⇒ Object



90
91
92
# File 'lib/gems/builder-2.1.2/lib/blankslate.rb', line 90

def find_hidden_method(name)
  nil
end

.method_added(name) ⇒ Object

Detect method additions to Object and remove them in the BlankSlate class.



83
84
85
86
87
88
# File 'lib/gems/builder-2.1.2/lib/blankslate.rb', line 83

def method_added(name)
  result = blank_slate_method_added(name)
  return result if self != Object
  BlankSlate.hide(name)
  result
end

Instance Method Details

#errors_for(meth_name) ⇒ Object



3
4
5
6
7
8
# File 'lib/mack/core_extensions/object.rb', line 3

def errors_for(meth_name)
  if self.respond_to?("errors") and self.errors
    return self.errors[meth_name.to_sym]
  end
  return nil
end

#has_errors?(meth_name) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
# File 'lib/mack/core_extensions/object.rb', line 10

def has_errors?(meth_name)
  res = errors_for(meth_name)
  return !res.empty? if res.is_a?(Array)
  return !res.blank?
end

#send_with_chain(methods, *args) ⇒ Object

:nodoc:



3
4
5
6
7
# File 'lib/gems/configatron-2.2.2/lib/configatron/core_ext/object.rb', line 3

def send_with_chain(methods, *args) # :nodoc:
  obj = self
  [methods].flatten.each {|m| obj = obj.send(m, *args)}
  obj
end