cialis online pharmacy generic xenical cheap cialis online cialis generic viagra online in canada buy cheap levitra online cialis without a perscription order viagra uk no prescription flagyl cheap generic levitra buying viagra in the uk cheap viagra approved cialis deltasone online buy viagra online without prescription non prescription cialis buy orlistat uk buy cialis in india prednisone 60 mg female viagra online buy viagra without prescription celebrex prescriptions buy cialis canada best prices viagra alternative to prednisone cheapest generic levitra levitra 5mg cheap viagra cialis on line buy xenical without prescription online accutane canadian health care prednisone no prescreption viagra online generic female viagra europe buy cialis low price cheap india viagra

Ruby Tips On Struct And OStruct Classes

Steve Klabnik wrote an interesting piece on how to take make the most of Ruby’s classes, which are the Struct class and OpenStruct class. In his blog post, Steve shares its documentation and gives a few good examples of where and when to take advantage of these structs and use them quite effectively.

For instance, using Struct.new gives you a Class.

From this:

class Point < Struct.new(:x, :y)
end

origin = Point.new(0,0)

To this:

1.9.3p194 :001 > Struct.new(:x,:y)
 => #<Class:0x007f8fc38da2e8> 

Although making an empty class may look like this:

Point = Struct.new(:x, :y)
origin = Point(0,0)

Related Posts

How to Efficiently Link to Existing WordPress Posts

How to Create A Basic Hipster-Style Layout

How to Choose The Right Web Designer For You

5 Common WordPress Mistakes and How To Correct Them