Class: Object

Inherits:
BasicObject
Defined in:
lib/Checked/DSL.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth_name, *args) ⇒ Object



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

def method_missing meth_name, *args
  return(super) if !Checked_applys?
  
  # Keep count after :Checked_applys? call
  #   because sometimes value is frozen.
  @count ||= 1
  @count += 1
  return(super) if @count > 6 
  
  raise "Unknown block." if block_given?
  return super unless Checked().respond_to?(meth_name)
  result = Checked().send meth_name, *args
  @count = 1
  
  if result.object_id != object_id && meth_name.to_s['!'] && self.class == result.class
    result.Checked= Checked() 
  end
  
  result
end

Instance Method Details

#CheckedObject



9
10
11
12
# File 'lib/Checked/DSL.rb', line 9

def Checked
  raise "Not defined yet." unless Checked_applys?
  @checked_arch
end

#Checked=(val) ⇒ Object



3
4
5
6
7
# File 'lib/Checked/DSL.rb', line 3

def Checked= val
  @checked_arch = val
  val.return! self
  val
end

#Checked_applys?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/Checked/DSL.rb', line 14

def Checked_applys?
  instance_variable_defined?(:@checked_arch)
end