Postings by leam hall

Up for Architectural Review?

Well, okay, feel free to comment on my Ruby. There's room for improvement.

I have been playing at some code for a while and decided to make it
actually "work" today. That means prioritizing a very few processes
and pushing back on scope creep.

Is this a decent start on a Factory?

Trying to learn the Factory pattern. What can be improved on the
"Crew" class as a Factory?


class Crew
def initialize(crew_number)
@crew = []
crew_number.times do
ncp =
career = ["Merchant", "Navy"].sample
terms = rand(1..3)
new_crewperson(career, terms, ncp)
@crew << ncp
def show_crew
counter = 1
@crew.each do |c|
print("Crewperson #%d is %d years old.

Why require autoconf 2.67+

Please pardon the intrusion; I am new to Ruby and like to pull the
development version of Ruby to compile and code with.

On 8 Feb 18 (US/Eastern) I pulled the code from GitHub and Ruby
2018-02-09 trunk 62326 compiled fine and all tests except for some
timezone ones passed.

Today I pulled the source again.

Module using object defined outside of method?

I have a class Dice with a method "roll_1". It gives a result between 1-6.

class Dice
def roll_1

The module CharacterTools uses Dice.roll_1.

module CharacterTools

require 'dice'
dice =

def roll_1
dice =

"dice" is declared twice, outside and inside the roll_1 method
definition. I am trying to figure out how to instantiate one "dice"
object outside of the method that calls it. For each program run there
are lots of calls to roll_1.

"90 Day Wonder" Mentoring

Having a mentor helps you grow much faster than just consuming a book or
video. Insightful feedback pushes you to learn faster. Mentors have long
been a strength of the coding community.

Except for those of us who don't work in a coding shop, or we're doing a
language/skill no one at work knows or cares about. IRC is good for fast
answers but not as helpful for long term growth.

A few years ago I ran a "90 Day Wonder" mentoring program. We took a
book and worked through it together. Since I wasn't a subject matter
expert I enlisted smarter people to help.

"Well used built in classes and modules" for Ruby Certification Exams?

The Silver Certification exam references:

"Well-used built-in classes and modules (e.g., Object, Numerical
classes, String, Array, Hash, Kernel, Enumerable, Comparable)"

The Gold Certification exam references:

" Well-used built-in classes and modules
(e.g., Object, Module, Kernel, Enumerable, Comparable)
Regular expression

Besides the ones specifically listed, which built in classes and modules
are considered "well used"?


-- Setting up for more Ruby in 2018!

Unsubscribe: <

Rakefile issue with Travis-CI

Probably Operator error.

Possible bug in updating glibc?

Hey all, not sure if this was operator error or what.

I'm running a KVM host on updated CentOS 6. The guest is built from the
CentOS 6.9 dvd1 with just @base and @core package groups.

When I went to install mysql it failed due to incompatibilities with the
libcc versions. Updated just glibc and glibc-common and then installed
mysql. Shortly there after it started to freeze and lost connection.

The KVM host is fairly beefy and mysql wasn't doing anything but running
with no queries or data.

Windows and Ruby?


It looks like the Installer issue has been taken up by some new folks,
cool. Still, it begs the question, is almost everyone doing Ruby doing so
on a non-Windows platform like Linux, Mac, or other *nix?


Confused on testing a Class as a Key in a Hash.

Actual code:
<a href="" title=""></a>

Trying to figure out why I can't compare a Hash key to it's value. The
key is a Class but if I use hash.each_key or each_pair it shows the key
and value. If I try to assert that hash[key] == value, it fails.

Besides a brain, a clue, and a life, what am I missing?



Unsubscribe: <>

Testing a written file?

This is the meat of a test I'm writing. The end state is that the test will
read a file another method has written. The goal is to test the writing
method. is there a better way? Should testing the nameserver IP addresses
go in a different test?

Yes, I'm probably doing a lot more testing than necessary.

to_i and to_s issue.

Trying to run a test to see if a to_i conversion in a method gives a
different string when converted back via to_s. The theory is that the
original_ip is the passed in a numeric only ip string. Unfortunately the
test fail thinking that "45" does not equal 45.to_s.

What am I missing, besides a brain, a clue, and a life? Is there a better
way to check?

How to share a ruby program without installed Ruby?

How do I take Ruby code and package it so I can give it to a Winderz or mac
user and they can run it without having to install Ruby? I would assume the
binaries would be different, but doable.



RubyTk and segfaults

Working with Ruby 2.4.0 and trying to see why it keeps seg faulting. I
saw an issue.

Ruby Jobs that are not Rails?

Not trying to cause an issue, but wondering what sorts of Ruby jobs there
are that are not Rails. Even Puppet seems to have moved away from using
Ruby directly.

SQLite update works in one file, fails in another.

In the second file, the save_characters() method fails to update the
database unless the upp string is manually set like:
upp = "777777"

If I edit the entry value it will print the new value, but not update.
If I use the same code in another program it works.

Generic class/design pattern question

I'm re-working old code from early efforts of learning Ruby. Now I'm trying
to get more OOP'ish and maybe figure out design patterns if they are
appropriate. I'm stuck on what do do with the "Career" concept.

Program design is pretty simple; there's a Class "Character" that stores
attributes of a Traveller RPG character.

Is $LOAD_PATH used for 'require "some_file"?'

Currently working on Winderz trying to figure out why

require "some_file"

Fails but

require "./some_file"

works. The $LOAD_PATH includes the directory the files being run and loaded
are in. Hit this issue on Linux as well, not sure if it's operator error or

Why does require need the "./" to find a file in the $LOAD_PATH?



How do you references database dirs in a gem?

The code I have works by making DATA_DIR from a relative path. When I
put that in a gem it fails to find the database. This is my first gem,
anyone have a good tutorial on how to make portable code find the
database, when the code goes from ${HOME}/<project> to



Unsubscribe: <>

First Gem fails to install

Ruby 1.8.7 on CentOS 6.

# As user
gem build ct_character_generator-0.0.1.gemspec
WARNING: no description specified
WARNING: no rubyforge_project specified
WARNING: deprecated autorequire specified
Successfully built RubyGem
Name: CT_Character_Generator
Version: 0.0.1
File: CT_Character_Generator-0.0.1-unknown.gem

# As root
gem install CT_Character_Generator-0.0.1-unknown.gem
ERROR: While executing gem ...

Nokogiri on Windows 7?

Anyone installed Nokogiri on Windows 7? I have fresh vanilla installs of
Ruby 2.2.6, nokogitri, mini_portile2-2.1.0, and RubyInstaller, When
I try to gem install nokogiri it bombs, mkmk.log below.




"gcc -o conftest.exe -IC:/Ruby22/include/ruby-2.2.0/i386-mingw32
-IC:/Ruby22/include/ruby-2.2.0/ruby/backward -IC:/Ruby22/include/ruby-2.2.0

Right classes and modules for use cases?

My character generator does the basic task and I want to expand it.
Since my experience has been with very small projects I'd like your
advice on scaling up well; the project is my path for learning more Ruby
and OOP.

Excellent Ruby code to read?

I keep seeing suggestions to read excellent Ruby code. Best suggestions
where to look? I'm interested in Ruby itself.



ipv6 validator

Any good ways of improving this as an ipv6 validator? Calling scripts
assume it's valid unless nil.



def self.ipv6(ip)
return nil if ip.match(/:::/)
ip_array = ip.split(":")
return nil if ip_array.count > 8 or ip_array.count < 1
ip_array.each do |octet|
return nil if octet.length > 4
return nil if octet.match(/[^[:xdigit:]]/)
return ip


What to do when object has lots of attributes?

N00bie question. I'm working on a Class that has lots of attributes that
can be set or get. I've been using attr_accessor but am wondering if
there's a better way to store data. At this point I'm looking at two or
three dozen attributes and being extended as needed.



Is there a Ruby mentorship program anywhere?

I am learning by readying the Pickaxe book and "The Ruby Way". My code
seems to be mostly working but it still looks a lot like my BASH code.
I'm trying to find some guidance on how to better use Ruby as Ruby.

Would prefer an "every week or so" e-mail conversation so we can avoid
global scheduling issues.

Any good Google search terms? Using "ruby" and "mentor" quickly dives
into Rails and Ruby Tuesdays. :)


Unsubscribe: <>

Using object's class in case statement?

I'm trying to use an object's class in a case statement.

How to Test::Unit a module that prints?

Some of the things I am writing print to STDOUT. How do you put that into a
test case for Test::Unit?



SQLite error just now showing up?

I'm getting the following error:

/usr/lib64/ruby/site_ruby/1.8/x86_64-linux/ warning: global
variable `$swig_runtime_data_type_pointer2' not initialized

What is more odd is that the Ruby and SQLite versions haven't changed and I
don't mess around with the Gem configurations. This error is new but the
database code calling sqlite3 hasn't changed for several months.

Any ideas on where to look?



Design review for classes and mixins

I've been refactoring a class as I re-read "Practical Object Oriented
Design in Ruby". Moving from "one class to rule them all" to as much
decoupling as possible. Looking for some critique of my new design.

<a href="" title=""></a>

The base class, Character, stores various attributes about a Traveller(tm)
character. Stats, age, skills, etc. Right now the plan is to store that in

There are a couple of Modules I'm working on. One (Traveller.rb), sort of a
Factory, that can set or change attributes.