Class: Digiproc::DataProperties::Slope::Zero

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

Overview

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

Class Method Summary collapse

Class Method Details

.==(val) ⇒ Object

Can test equality in multiple ways: Digiproc::DataProperties::Slope::Zero == OpenStruct.new(type: :zero) # true Digiproc::DataProperties::Slope::Zero == :zero # true Digiproc::DataProperties::Slope::Zero == “zero” # true, not case sensitive



201
202
203
204
205
206
207
208
209
210
# File 'lib/concerns/data_properties.rb', line 201

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

.is?(val) ⇒ Boolean

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

Returns:

  • (Boolean)


218
219
220
# File 'lib/concerns/data_properties.rb', line 218

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

.typeObject



192
193
194
# File 'lib/concerns/data_properties.rb', line 192

def self.type
    :zero
end