class CrystalScad::AdvancedPrimitive

Constants

NUMERIC_ATTRIBUTES

Public Class Methods

new(attributes) click to toggle source
Calls superclass method
# File lib/crystalscad/CrystalScad.rb, line 271
def initialize(attributes)
                    @attr = attributes.collect { |k, v|
                            value_output = if NUMERIC_ATTRIBUTES.include?(k.to_sym)
                                    v.to_f
                            else
                                    "\"#{v}\""
                            end

                            "#{k} = #{value_output}"
                    }.join(', ')
  super
end
numeric_attribute(*attribute_names)
Alias for: numeric_attributes
numeric_attributes(*attribute_names) click to toggle source
# File lib/crystalscad/CrystalScad.rb, line 261
def self.numeric_attributes(*attribute_names)
                    Array(attribute_names).flatten.each do |attrbute_name|
                            NUMERIC_ATTRIBUTES << attrbute_name.to_sym
                    end
            end
Also aliased as: numeric_attribute

Public Instance Methods

to_rubyscad() click to toggle source
# File lib/crystalscad/CrystalScad.rb, line 284
def to_rubyscad
                "#{@operation}(#{@attr});"
        end