# Update to x10-cm17a gem for 1.9.1

**URL:** <https://www.ruby-forum.com/t/update-to-x10-cm17a-gem-for-1-9-1/175883>\
**Category:** Ruby\
**Created:** [September 22, 2009, 6:21am UTC](https://www.ruby-forum.com/t/update-to-x10-cm17a-gem-for-1-9-1/175883 "2009-09-22T06:21:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![barjunk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@barjunk](https://www.ruby-forum.com/u/barjunk)\
**Post date:** [September 22, 2009, 6:21am UTC](https://www.ruby-forum.com/t/update-to-x10-cm17a-gem-for-1-9-1/175883/1 "2009-09-22T06:21:37Z")

</div>

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.
