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



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

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?
  begin
    result = Checked().get!(meth_name, *args)
  rescue Sin_Arch::Not_Found
    return super
  end
  @count = 1
  
  result.Checked.<< Checked()
  result
end

Instance Method Details

#CheckedObject



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

def Checked
  @sin_arch ||= begin
                  o = ::Checked::Obj.new
                  o.value = self
                  o
                end
end

#Checked_applys?Boolean



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

def Checked_applys?
  (instance_variable_defined?(:@sin_arch) && Checked().on?)
end