Class: Digiproc::DataProperties::Slope::Negative

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

Overview

Used in the Slope class to indicate a negative slope. Made for easy syntax purposes

Class Method Summary collapse

Class Method Details

.==(val) ⇒ Object

Can test equality in multiple ways: Digiproc::DataProperties::Slope::Negative == OpenStruct.new(type: :negative) # true Digiproc::DataProperties::Slope::Negative == :negative # true Digiproc::DataProperties::Slope::Negative == “negative” # true



131
132
133
134
135
136
137
138
139
140
# File 'lib/concerns/data_properties.rb', line 131

def self.==(val)
    if val.respond_to? :type
        return true if val.type == :negative
    end
    return true if val == :negative
    if val.respond_to? :downcase
        return true if val.downcase == "negative"
    end
    false
end

.is?(val) ⇒ Boolean

Alias to == Can test equality in multiple ways: Digiproc::DataProperties::Slope::Negative.is? OpenStruct.new(type: :negative) # true Digiproc::DataProperties::Slope::Negative.is? :negative # true Digiproc::DataProperties::Slope::Negative.is? “negative” # true, not case sensitive

Returns:

  • (Boolean)


148
149
150
# File 'lib/concerns/data_properties.rb', line 148

def self.is?(val)
    self.==(val)
end

.typeObject

Used for comparison in == returns :negative



122
123
124
# File 'lib/concerns/data_properties.rb', line 122

def self.type
    :negative
end