Module: Fix::Helper::ItsHelper

Included in:
On
Defined in:
lib/fix/helper/its_helper.rb

Instance Method Summary collapse

Instance Method Details

#its(attribute, *args, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/fix/helper/its_helper.rb', line 4

def its attribute, *args, &block
  unless instance_variable_defined? :@object
    raise MissingSubjectError,  "Incomplete specifications.  " \
                                "Please specify a `subject` on the top."
  end

  @defs = {} unless instance_variable_defined? :@defs
  @args = [] unless instance_variable_defined? :@args

  i = Its.new @object, @defs, *(@args + [[attribute] + args])
  i.instance_eval(&block)
end