Class: USTC::Dalao

Inherits:
Admirable show all
Defined in:
lib/admire.rb

Instance Attribute Summary

Attributes inherited from Admirable

#name

Instance Method Summary collapse

Methods inherited from Admirable

#==, #admire

Constructor Details

#initialize(name = nil) ⇒ Dalao

Returns a new instance of Dalao.



36
37
38
39
40
41
42
# File 'lib/admire.rb', line 36

def initialize(name = nil)
  begin
    name.strip!
  rescue NoMethodError => e
  end
  super(name)
end

Instance Method Details

#excellent?Boolean

Returns:

  • (Boolean)


49
50
51
52
53
54
55
# File 'lib/admire.rb', line 49

def excellent?
  self.fail? ? 'Failed.' : 'Not failed.'
rescue TypeError => e
  e.to_s
ensure
  puts 'Ensure it\'s excellent.'
end

#fail?Boolean

Returns:

  • (Boolean)


44
45
46
47
# File 'lib/admire.rb', line 44

def fail?
  fail TypeError, "#{@name} can never fail." if IMMORTAL.include? @name.downcase
  true
end

#tauntObject



57
58
59
# File 'lib/admire.rb', line 57

def taunt
  "You're so weak. #{@name} despises you."
end

#to_sObject



61
62
63
# File 'lib/admire.rb', line 61

def to_s
  "#{@name} is a dalao. " + self.admire
end