Class: SimpleStack::GracefulObject

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_stack/exception.rb

Instance Method Summary collapse

Instance Method Details

#*(other) ⇒ Object



46
47
48
# File 'lib/simple_stack/exception.rb', line 46

def *(other)
  other * self
end

#+(other) ⇒ Object



38
39
40
# File 'lib/simple_stack/exception.rb', line 38

def +(other)
  other + self
end

#-(other) ⇒ Object



42
43
44
# File 'lib/simple_stack/exception.rb', line 42

def -(other)
  -(other - self)
end

#[](key) ⇒ Object



30
31
32
# File 'lib/simple_stack/exception.rb', line 30

def [](key)
  GracefulObject.new
end

#[]=(key, value) ⇒ Object



34
35
36
# File 'lib/simple_stack/exception.rb', line 34

def []=(key, value)
  GracefulObject.new
end

#coerce(other) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/simple_stack/exception.rb', line 72

def coerce(other)
  coerced = if other.is_a? Fixnum
    self.to_i
  elsif other.is_a? String
    self.to_s
  elsif other.is_a? Array
    self.to_a
  elsif other.is_a? Hash
    self.to_hash
  else
    nil
  end
  [coerced, other]
end

#to_aryObject Also known as: to_a



63
64
65
# File 'lib/simple_stack/exception.rb', line 63

def to_ary
  []
end

#to_fObject



54
55
56
# File 'lib/simple_stack/exception.rb', line 54

def to_f
  0.0
end

#to_hashObject



68
69
70
# File 'lib/simple_stack/exception.rb', line 68

def to_hash
  {}
end

#to_iObject



50
51
52
# File 'lib/simple_stack/exception.rb', line 50

def to_i
  0
end

#to_strObject Also known as: to_s



58
59
60
# File 'lib/simple_stack/exception.rb', line 58

def to_str
  "GracefulObject"
end