Class: String

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

Instance Method Summary collapse

Instance Method Details

#to_yaml_booleanObject



16
17
18
19
20
21
22
23
24
# File 'lib/ssh_bro.rb', line 16

def to_yaml_boolean
  if self.yaml_truthy?
    return true
  elsif self.yaml_falsey?
    return false
  else
    self
  end
end

#yaml_falsey?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/ssh_bro.rb', line 12

def yaml_falsey?
  ['n', 'no', 'false'].include?(self.downcase)
end

#yaml_truthy?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/ssh_bro.rb', line 8

def yaml_truthy?
  ['y', 'yes', 'true'].include?(self.downcase)
end