sketchup

How to count duplicates hash itens in Ruby 1.8.5 ( Sketchup Ruby API )

那年仲夏 提交于 2019-12-01 12:28:11
I need to count the duplicates, they need to be 100% identical to increase my count, but I can not use a nothing out of Ruby 1.8.5, this code will run inside a plugin in google sketchup Google Sketchup Ruby API puts VERSION 1.8.5 puts RUBY_PLATFORM i686-darwin8.10.1 product = 'Glass' x = width y = length z = density product_list = [ { "product" => 1, "x" => 200, "y" => 100, "z" => 18}, { "product" => 1, "x" => 200, "y" => 100, "z" => 18}, { "product" => 1, "x" => 300, "y" => 100, "z" => 18}, { "product" => 2, "x" => 300, "y" => 100, "z" => 18}, { "product" => 2, "x" => 100, "y" => 100, "z" =>

Detecting Operating Systems in Ruby [duplicate]

落花浮王杯 提交于 2019-11-27 12:01:59
This question already has an answer here: How can I find which operating system my Ruby program is running on? 10 answers Is there a way to detect the operating system in ruby? I am working on developing a sketchup tool that will need to detect Mac vs. Windows. debbie You can use the os gem: gem install os And then require 'os' OS.linux? #=> true or false OS.windows? #=> true or false OS.java? #=> true or false OS.bsd? #=> true or false OS.mac? #=> true or false # and so on. See: https://github.com/rdp/os Here is the best one I have seen recently. It is from selenium. The reason I think it is