Class: Object

Inherits:
BasicObject
Defined in:
lib/quarter_system/argumentation/object.rb

Overview

Custom handling or arguments: Allows things like User.with_arguments(1, 2, 3).find(:order => ‘id DESC’)

result: => User.find(1, 2, 3, :order => 'id DESC')

but also checks to see that arguments are valid.

Also, allows us to condense patterns like: record.perform_action! if record.respond_to?(:perform_action!) by doing the following instead record.maybe.perform_action!

Instance Method Summary collapse

Instance Method Details

#with_arguments(*arguments) ⇒ Object



10
11
12
13
# File 'lib/quarter_system/argumentation/object.rb', line 10

def with_arguments(*arguments)
  arg_merger = ArgumentMerger.new(self, arguments)
  block_given? ? yield(arg_merger) : arg_merger
end

#with_nonnil(*arguments) ⇒ Object



16
# File 'lib/quarter_system/argumentation/object.rb', line 16

def with_nonnil(*arguments);  with_arguments(*arguments.merge_options(:nonnil   => true)); end

#with_present(*arguments) ⇒ Object



17
# File 'lib/quarter_system/argumentation/object.rb', line 17

def with_present(*arguments); with_arguments(*arguments.merge_options(:present  => true)); end