Module: BallGag::ClassMethods

Defined in:
lib/ball_gag/gag.rb

Instance Method Summary collapse

Instance Method Details

#clear_gagged_attributesObject



39
40
41
# File 'lib/ball_gag/gag.rb', line 39

def clear_gagged_attributes
  undefine_gagged_attributes_methods
end

#gag(*arguments, &block) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ball_gag/gag.rb', line 20

def gag *arguments, &block
  define_and_mixin_gagged_attributes_methods

  callable = arguments.pop if arguments.last.respond_to? :call
  options = arguments.pop if arguments.last.kind_of? Hash

  to_call = callable || block || BallGag.engine ||
    lambda { |*| raise NoEngineConfiguredError }

  define_not_gagged_interpellations(arguments, to_call, options)

  arguments.each do |attribute|
    @gagged_attributes[attribute] = to_call
    define_gagged_interpellation attribute
  end

  arguments
end

#gagged_attributesObject



15
16
17
18
# File 'lib/ball_gag/gag.rb', line 15

def gagged_attributes
  clear_gagged_attributes unless @gagged_attributes
  @gagged_attributes.keys
end