class Giter8::Pair
Pair
represent a key-value property pair
Constants
- PLAIN_KEY
Attributes
key[RW]
value[RW]
Public Class Methods
new(key, value)
click to toggle source
# File lib/giter8/pair.rb, line 10 def initialize(key, value) key = key.to_sym if !key.is_a?(Symbol) && PLAIN_KEY.match?(key) @key = key @value = value end
Public Instance Methods
==(other)
click to toggle source
# File lib/giter8/pair.rb, line 23 def ==(other) same_pair = other.is_a?(Pair) && other.key == @key && other.value == @value same_hash = other.is_a?(Hash) && other == { @key => @value } same_hash || same_pair end
truthy?()
click to toggle source
Determines whether the Pair's value contains a truthy value. See Conditional.truthy?
# File lib/giter8/pair.rb, line 19 def truthy? Conditional.truthy? @value end