Update to x10-cm17a gem for 1.9.1

I didn’t find a good way to pass this patch along to those that are
maintaining the module for x10-cm17a gem. I suspect since there
hasn’t been any activity on it for quite sometime, that there is
currently no interest.

On the off chance that there is or someone wants to use this module in
1.9.1, you can apply this patch:

— start of patch —

— /usr/lib/ruby/gems/1.9.1/gems/x10-cm17a-1.0.1/lib/x10.rb
2009-09-21 19:50:25.669977482 -0800
+++ x10.rb 2009-09-21 19:47:48.269007712 -0800
@@ -60,7 +60,11 @@
# Make a canonical X10 device address from the house number and
# unit. House and unit numbers are zero based.
def make_address(house, unit)

  •  (house + ?a).chr + (unit+1).to_s
    
  •  if "a"[0].respond_to?(:-) then
    
  •     (house + ?a).chr + (unit+1).to_s
    
  •  else # ruby 1.9 doesn't do character math
    
  •     (house + 97).chr + (unit+1).to_s
    
  •  end
    

    end

    Parse a canonical X10 device adderss into house number and unit

@@ -77,7 +81,11 @@
fail X10::X10Error, “Bad X10 device address [#{address}]”
end

  •  house = address[0] - ?a
    
  •  if address[0].respond_to?(:-) then
    
  •    house = address[0] - ?a
    
  •  else  #ruby 1.9 doesn't have :-
    
  •    house = address.getbyte(0) - 97
    
  •  end
     [house, unit]
    
    end

---- end of patch ----

Someone that knows ruby better might have a more elegant solution, but
this one works for me.

Mike B.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs