Class: Digiproc::DataProperties::Slope::Positive

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

Overview

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

Class Method Summary collapse

Class Method Details

.==(val) ⇒ Object

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



166
167
168
169
170
171
172
173
174
175
# File 'lib/concerns/data_properties.rb', line 166

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

.is?(val) ⇒ Boolean

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

Returns:

  • (Boolean)


183
184
185
# File 'lib/concerns/data_properties.rb', line 183

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

.typeObject



157
158
159
# File 'lib/concerns/data_properties.rb', line 157

def self.type
    :positive
end