Class: Hobo::Undefined

Inherits:
Object
  • Object
show all
Defined in:
lib/hobo/undefined.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Undefined

Returns a new instance of Undefined.



5
6
7
8
# File 'lib/hobo/undefined.rb', line 5

def initialize(*args)
  options = args.extract_options!
  @klass = args.first || Object
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



34
35
36
# File 'lib/hobo/undefined.rb', line 34

def method_missing(name, *args)
  raise UndefinedAccessError.new("call to: Hobo::Undefined##{name}")
end

Instance Method Details

#classObject



14
15
16
# File 'lib/hobo/undefined.rb', line 14

def class
  @klass
end

#hobo_undefined?Boolean

Returns:



10
11
12
# File 'lib/hobo/undefined.rb', line 10

def hobo_undefined?
  true
end

#inspectObject



26
27
28
# File 'lib/hobo/undefined.rb', line 26

def inspect
  to_s
end

#is_a?(klass) ⇒ Boolean

Returns:



18
19
20
# File 'lib/hobo/undefined.rb', line 18

def is_a?(klass)
  return klass == @klass || klass > @klass
end

#new_record?Boolean

Returns:



30
31
32
# File 'lib/hobo/undefined.rb', line 30

def new_record?
  true
end

#to_sObject



22
23
24
# File 'lib/hobo/undefined.rb', line 22

def to_s
  "<Hobo::Undefined #{@klass}>"
end