class Cassowary::Variable

Overview

An unknown the solver assigns a value to.

#value holds the result of the last Solver#update. Use each variable in one solver only, since every solver writes its solution into #value.

NOTE == builds a Constraint and != does not compile, so compare variables with same?, and key a Hash by variables only after calling Hash#compare_by_identity on it.

Included Modules

Defined in:

cassowary/variable.cr

Constructors

Instance Method Summary

Instance methods inherited from module Cassowary::Operand

!=(other : Operand | Number) : NoReturn !=, *(other : Number) : Expression *, +(other : Operand) : Expression
+(other : Number) : Expression
+
, -(other : Operand) : Expression
-(other : Number) : Expression
- : Expression
-
, /(other : Number) : Expression /, <=(other : Operand | Number) : Constraint <=, ==(other : Operand | Number) : Constraint ==, >=(other : Operand | Number) : Constraint >=, to_expression : Expression to_expression

Constructor Detail

def self.new(name : String = "") #

[View source]

Instance Method Detail

def inspect(io : IO) : Nil #
Description copied from class Reference

Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).inspect # => #<Person:0x10fd31f20 @name="John", @age=32>

[View source]
def name : String #

[View source]
def to_expression : Expression #

Returns an expression holding only this variable.


[View source]
def to_s(io : IO) : Nil #
Description copied from class Reference

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>

[View source]
def value : Float64 #

[View source]