Class: Habaki::Angle

Inherits:
Value show all
Defined in:
lib/habaki/value.rb

Overview

<angle> value type in deg, rad

Instance Attribute Summary collapse

Attributes inherited from Value

#data

Instance Method Summary collapse

Methods inherited from Value

#==, #eql?, #hash

Methods inherited from Node

#to_s

Constructor Details

#initialize(data = nil, unit = nil) ⇒ Angle

Returns a new instance of Angle.



198
199
200
201
# File 'lib/habaki/value.rb', line 198

def initialize(data = nil, unit = nil)
  @data = data
  @unit = unit
end

Instance Attribute Details

#unitSymbol

Returns:

  • (Symbol)


196
197
198
# File 'lib/habaki/value.rb', line 196

def unit
  @unit
end

Instance Method Details

#read_from_katana(val) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.



211
212
213
214
215
# File 'lib/habaki/value.rb', line 211

def read_from_katana(val)
  @data = val.value
  @unit = val.unit
  @unit = nil if @unit == :dimension
end

#string(format = Formatter::Base.new) ⇒ String

Parameters:

Returns:



205
206
207
# File 'lib/habaki/value.rb', line 205

def string(format = Formatter::Base.new)
  @unit ? "#{data_i_or_f}#{@unit}" : @data
end