1
2
3
4
module Menus
  
 def self.getValidPositiveNumber
...

Ruby Good way to output menu wit...

by tragicdancer.myopenid.com, August 30, 2010 17:28, 1 refactoring, tagged with ruby

What would be the best or a...

Avatar Talk
1
2
3
4
<% if I18n.locale == :pl %>
    <%= link_to 'PL', { :locale => :pl }, :class => "language_selected" %> | <%= link_to 'ENG', { :locale => :en } %>
<% else %>
...

Ruby Language Selection

by Omer Jakobinsky, August 25, 2010 10:47, 3 refactorings, tagged with ruby, rails

Hi, I'm sure this is the mo...

A289beedc9fd9fdeaaa905bd755f6f98 Talk
1
2
3
4
openid_mapping = {
  :email => ["email", "http://axschema.org/contact/email"], 
  :name => ["fullname", "http://axschema.org/namePerson"]
...

Ruby Hash + Array refactor

by Oriol, August 19, 2010 17:56, 3 refactorings, tagged with ruby, hash, array, openid, sreg, axschema

This actually works but I w...

E4679be8d7d2484f9c0b8c4df71f4d2a Talk
1
2
hash = {}
array.each { |key| hash[key] = func(key) }

Ruby How to make it more idiomatic?

by AlekSi, August 16, 2010 11:58, 6 refactorings, tagged with ruby, idiomatic, idioms

Can you make this code more...

Af19cd0c0141bf7d6b42516706eb1d1d Talk
1
2
3
4
    def include_class?(obj_class)
      stack = []
    
...

Ruby hash.include_class?, recursive

by unixcharles, August 09, 2010 00:20, 1 refactoring, tagged with short, ruby

I have a hash like this one...

23e6178f295b9cb7473d44d9e501a2b3 Talk
1
2
3
4
# link_categories has_many links
create_table "link_categories", :force => true do |t|
  t.string   "name"
...

Ruby Find records according to r...

by https://www.google.com/accounts/o8/id?id=AItOawl_CInyr4p6Fw9fCXT3DYEGIiMyGOQDomw, August 02, 2010 18:43, 1 refactoring, tagged with rails, ruby, activerecord, sql

I have a method (LinkCatego...

Avatar Talk
1
2
3
4
require 'uri'
require 'net/http'
require 'net/https'
...

Ruby Ugly net/http code

by spaghetticode, August 02, 2010 06:37, No refactoring, tagged with ruby, net/http

I am not an expert of the n...

A3897deec9b1dbc6def9f5dfcb58bb60 Talk
1
2
3
4
require 'ruby_camping'
require 'camping_guests'

...

Ruby Help!! undefined method for...

by tragicdancer.myopenid.com, July 27, 2010 10:06, 5 refactorings, tagged with ruby

Hi! Ive posted before about...

Avatar Talk
1
2
3
4
require 'guest'
require 'parking_lot' 

...

Ruby `initialize': wrong number ...

by tragicdancer.myopenid.com, July 22, 2010 13:36, -1 refactorings, tagged with ruby

Hi Im getting this error wh...

Avatar Talk
1
2
3
4
  def is_pos_activation?
    if session[:pos_activation]
      block_given? ? yield : true
...

Ruby better way?

by RoadHouse, July 21, 2010 18:48, 5 refactorings, tagged with block, ruby, if

i like this code, but exist...

70089e712ed13abb99bec89bd5bfba77 Talk
1
2
3
4
require 'guest'
require 'parking_lot'

...

Ruby undefined method for nil:Ni...

by tragicdancer.myopenid.com, July 19, 2010 15:06, 3 refactorings, tagged with ruby

Hi!
whn i try and run my p...

Avatar Talk
1
2
3
4
 puts "Please enter the sentence to be encrypted: "
 plaintext = gets.chomp.upcase!
 puts "Please enter the vigenere key: "
...

Ruby Vigenere cipher implementation

by doctorno.myopenid.com, July 17, 2010 17:43, 4 refactorings, tagged with vigenere, ruby, cipher

I tried implementing this b...

Ca88e43e229390850b8be73459a418bf Talk
1
2
3
4
def name_repair(var) 
      
   car_names1 = ["HONDA",      
...

Ruby Can I remove the return sta...

by bain19.myopenid.com, July 04, 2010 06:31, 3 refactorings, tagged with ruby, logic, I, fail

What this method does is; I...

642d333608cc3483f64dba38cb81bdd2 Talk
1
2
3
4
class Array
    
  def count_by(&block)
...

Ruby Array.group_by that counts

by matt, June 26, 2010 23:38, 4 refactorings, tagged with group_by, array, ruby

I want an array method that...

081c31620e9ed8dca87afeeeeb279f68 Talk
1
2
3
4
    ls = LineStream.new(true)
    bl = ls.retrieve
    line_msg = ls.messagize(bl, false) # long format
...

Ruby Checking validity of messag...

by keruilin.myopenid.com, June 25, 2010 11:25, 3 refactorings, tagged with ruby, refactor, twitter

I have an ActivityStrea...

2669fbd62908cf7787bd6ac81bad624c Talk
1
2
3
4
class Plugin
end

...

Ruby Ruby Plugin Architecture

by https://www.google.com/accounts/o8/id?id=AItOawlKpxnaxLBwJZw7qplOz63o5Aijey0qO5U, June 25, 2010 03:55, 1 refactoring, tagged with ruby, plugins

I am pretty lost on this, t...

Avatar Talk
1
2
3
4
class MyFancyClass
  def initialize(hash)
...
...

Ruby Handling reserved word coll...

by unixcharles, June 16, 2010 00:19, 2 refactorings, tagged with ruby, json

When you work with APIs tha...

23e6178f295b9cb7473d44d9e501a2b3 Talk
1
2
3
class Store < ActiveRecord::Base
  has_many :promos
...

Ruby Rails Store has more than m...

by Kenzie, June 08, 2010 00:21, 1 refactoring, tagged with ruby, rails, model, associations

Store has many Promos. Prom...

0f8736dfd93c21c75ad591770a14bdb4 Talk
1
2
3
4
  def check_win_streak(streak)
    badge = 10
    while badge < BADGE::MAX_STREAK_BADGE_SIZE do # MAX_STREAK_BADGE_SIZE = 30
...

Ruby how to refactor tricky logi...

by keruilin.myopenid.com, June 06, 2010 20:32, 6 refactorings, tagged with ruby, rails, logic

The rule at work here is th...

2669fbd62908cf7787bd6ac81bad624c Talk
1
2
3
4
require 'date'

#Get data from user for memo
...

Ruby Simple Ruby Program for cre...

by thehodapp.myopenid.com, June 01, 2010 04:08, 3 refactorings, tagged with ruby, I/O, String Manipulation

This is the first program I...

A080437f9a305a2f2a8ce517b304ad00 Talk
1
2
3
4
#!/usr/bin/ruby

=begin
...

Ruby I'm having trouble thinking...

by lordzoner.myopenid.com, May 22, 2010 22:32, 3 refactorings, tagged with ruby, refactor, euler18

I'm working on Project Eule...

88f4aad84b5441c255cbe96a0fcc6319 Talk
1
2
3
4
last_vehicle = Vehicle.find(:first, :order => 'id desc')

unless last_vehicle.blank?
...

Ruby Ruby on Rails reverse 'build'

by sperchard.myopenid.com, May 09, 2010 12:50, 2 refactorings, tagged with rails, ruby, build

In this scenario, a new Veh...

Avatar Talk
1
2
3
4
def update
    rayon = Rayon.find(params[:id])
    if rayon.update_attributes(params[:rayon])
...

Ruby Ruby if/else statement

by suborx.myopenid.com, May 08, 2010 12:21, 1 refactoring, tagged with ruby

0 vote down star

...

Avatar Talk
1
2
3
4
arr = []
b={:a => "option1", :b => "option2"}
b.each_pair{ |key,value| arr << "#{key}=#{value}" }
...

Ruby HTML query string

by jalapinto.myopenid.com, April 29, 2010 00:04, 5 refactorings, tagged with params, ruby, html, query

Trying to create the query ...

Avatar Talk
1
2
3
4
class TryAgain < RuntimeError; end

class RetryLoop
...

Ruby Retry Loop

by openid.claimid.com/scottburton11, April 22, 2010 07:13, 1 refactoring, tagged with ruby, retry, fail

Here's an abstract way to r...

F9bf9d54441b20b8d880313b569cf88d Talk