Class: AdvAccessor::Checker

Inherits:
Object
  • Object
show all
Includes:
FromHash
Defined in:
lib/adv_accessor/checker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#objObject

Returns the value of attribute obj.



4
5
6
# File 'lib/adv_accessor/checker.rb', line 4

def obj
  @obj
end

Instance Method Details

#match?(o) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
13
14
15
# File 'lib/adv_accessor/checker.rb', line 5

def match?(o)
  if obj.kind_of?(Proc)
    !!obj[o]
  elsif obj.kind_of?(Class)
    o.kind_of?(obj)
  elsif obj.kind_of?(Regexp)
    !!(o =~ obj)
  else
    o == obj
  end
end