Class: String

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

Instance Method Summary collapse

Instance Method Details

#is_i?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/json2properties.rb', line 7

def is_i?
	/\A-?\d+\z/ === self
end

#is_numeric?Boolean

Returns:

  • (Boolean)


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

def is_numeric?
	return true if self.is_i?
	true if Float(self) rescue false
end

#is_numeric_leading_zero?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/json2properties.rb', line 16

def is_numeric_leading_zero?
	self[0].eql?("0") && self.length > 1
end

#is_numeric_with_underscores?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/json2properties.rb', line 20

def is_numeric_with_underscores?
	self.is_numeric? && self.include?('_')
end