class Marathon::Constraint
This class represents a Marathon
Constraint
. See mesosphere.github.io/marathon/docs/constraints.html for full details.
Public Class Methods
new(array)
click to toggle source
Create a new constraint object. array
: Array returned by API, holds attribute, operator and parameter.
Calls superclass method
Marathon::Base::new
# File lib/marathon/constraint.rb, line 7 def initialize(array) raise Marathon::Error::ArgumentError, 'array must be an Array' unless array.is_a?(Array) raise Marathon::Error::ArgumentError, 'array must be [attribute, operator, parameter] where only parameter is optional' \ unless array.size != 2 or array.size != 3 super end
Public Instance Methods
attribute()
click to toggle source
# File lib/marathon/constraint.rb, line 15 def attribute info[0] end
operator()
click to toggle source
# File lib/marathon/constraint.rb, line 19 def operator info[1] end
parameter()
click to toggle source
# File lib/marathon/constraint.rb, line 23 def parameter info[2] end
to_pretty_s()
click to toggle source
Returns a string for listing the constraint.
# File lib/marathon/constraint.rb, line 36 def to_pretty_s info.join(':') end
to_s()
click to toggle source
# File lib/marathon/constraint.rb, line 27 def to_s if parameter "Marathon::Constraint { :attribute => #{attribute} :operator => #{operator} :parameter => #{parameter} }" else "Marathon::Constraint { :attribute => #{attribute} :operator => #{operator} }" end end