class SimplestStatus::Status
Attributes
name[R]
value[R]
Public Class Methods
new(input)
click to toggle source
# File lib/simplest_status/status.rb, line 5 def initialize(input) @name, @value = Array(input) end
Public Instance Methods
==(status)
click to toggle source
# File lib/simplest_status/status.rb, line 38 def ==(status) self.to_hash == status.to_hash end
constant_name()
click to toggle source
# File lib/simplest_status/status.rb, line 26 def constant_name string.upcase end
for_select()
click to toggle source
# File lib/simplest_status/status.rb, line 34 def for_select [label, value] end
label()
click to toggle source
# File lib/simplest_status/status.rb, line 30 def label string.split(/[\s_-]+/).map(&:capitalize).join(' ') end
matches?(input)
click to toggle source
# File lib/simplest_status/status.rb, line 22 def matches?(input) [string, value.to_s].include? input.to_s end
string()
click to toggle source
# File lib/simplest_status/status.rb, line 13 def string name.to_s end
Also aliased as: to_s
symbol()
click to toggle source
# File lib/simplest_status/status.rb, line 9 def symbol name.to_sym end
to_hash()
click to toggle source
# File lib/simplest_status/status.rb, line 18 def to_hash { name => value } end