[#17566] rubychecker - runs checks on a Ruby interpreter — Igal Koshevoy <igal@...>

I've put together a shell script that runs checks on a Ruby interpreter.

14 messages 2008/07/03

[#17615] [PATCH] ruby-mode.el: Fix here-doc strings with inner quotes — Nathan Weizenbaum <nex342@...>

At the moment, ruby-mode.el uses font-lock-keywords as opposed to

22 messages 2008/07/05
[#17657] Re: [PATCH] ruby-mode.el: Fix here-doc strings with inner quotes — Yukihiro Matsumoto <matz@...> 2008/07/08

[#17678] Re: [PATCH] ruby-mode.el: Fix here-doc strings with inner quotes — Nathan Weizenbaum <nex342@...> 2008/07/09

It was designed to fix the following case:

[#17755] Re: [PATCH] ruby-mode.el: Fix here-doc strings with inner quotes — Nathan Weizenbaum <nex342@...> 2008/07/13

Here's a third patch that fixes a bug in the second and uses a quicker

[#17772] Re: [PATCH] ruby-mode.el: Fix here-doc strings with inner quotes — Nathan Weizenbaum <nex342@...> 2008/07/15

One more patch which fixes a few bugs in the the last one.

[#17773] Re: [PATCH] ruby-mode.el: Fix here-doc strings with inner quotes — Nobuyoshi Nakada <nobu@...> 2008/07/15

Hi,

[#17776] Re: [PATCH] ruby-mode.el: Fix here-doc strings with inner quotes — Nathan Weizenbaum <nex342@...> 2008/07/15

Looks like version 22 doesn't support explicitly numbered regexp groups.

[#17779] Re: [PATCH] ruby-mode.el: Fix here-doc strings with inner quotes — Nobuyoshi Nakada <nobu@...> 2008/07/15

Hi,

[#17783] Re: [PATCH] ruby-mode.el: Fix here-doc strings with inner quotes — Nobuyoshi Nakada <nobu@...> 2008/07/15

Hi,

[#17788] Re: [PATCH] ruby-mode.el: Fix here-doc strings with inner quotes — Nathan Weizenbaum <nex342@...> 2008/07/15

Alright, here's a version that fixes both the highlighting bug and the

[#17793] Re: [PATCH] ruby-mode.el: Fix here-doc strings with inner quotes — Nobuyoshi Nakada <nobu@...> 2008/07/16

Hi,

[#17644] Features to be included in Ruby 1.9.1 — "Yugui (Yuki Sonoda)" <yugui@...>

Hi, all

27 messages 2008/07/08

[#17674] [Ruby 1.8 - Bug #238] (Open) Ruby doesn't respect the Windows read-only flag — Jim Deville <redmine@...>

Issue #238 has been reported by Jim Deville.

10 messages 2008/07/08

[#17708] [Ruby 1.8 - Bug #252] (Open) Array#sort doesn't respect overridden <=> — Ryan Davis <redmine@...>

Issue #252 has been reported by Ryan Davis.

13 messages 2008/07/09

[#17871] duping the NilClass — "Nasir Khan" <rubylearner@...>

While nil is an object, calling dup on it causes TypeError. This doesnt seem

33 messages 2008/07/20
[#17872] Re: duping the NilClass — Urabe Shyouhei <shyouhei@...> 2008/07/20

Nasir Khan wrote:

[#17873] Re: duping the NilClass — "Meinrad Recheis" <meinrad.recheis@...> 2008/07/20

On Sun, Jul 20, 2008 at 7:55 PM, Urabe Shyouhei <shyouhei@ruby-lang.org>

[#17877] Re: duping the NilClass — Urabe Shyouhei <shyouhei@...> 2008/07/20

Meinrad Recheis wrote:

[#17879] Re: duping the NilClass — Kurt Stephens <ks@...> 2008/07/20

Urabe Shyouhei wrote:

[#17880] Re: duping the NilClass — "Nasir Khan" <rubylearner@...> 2008/07/21

I write a lot of hand crafted dup or clone because I want control as well as

[#17881] Re: duping the NilClass — "David A. Black" <dblack@...> 2008/07/21

Hi --

[#17882] Re: duping the NilClass — Urabe Shyouhei <shyouhei@...> 2008/07/21

+1 to David. A convenient way to do Marshal idiom should be a new

[#17885] Re: duping the NilClass — "Robert Dober" <robert.dober@...> 2008/07/21

On Mon, Jul 21, 2008 at 8:21 AM, Urabe Shyouhei <shyouhei@ruby-lang.org> wrote:

[#17887] Re: duping the NilClass — "David A. Black" <dblack@...> 2008/07/21

Hi --

[#17889] Re: duping the NilClass — "Robert Dober" <robert.dober@...> 2008/07/21

On Mon, Jul 21, 2008 at 1:02 PM, David A. Black <dblack@rubypal.com> wrote:

[#17883] [Ruby 1.9 - Bug #340] (Open) 1.9/trunk does not work when compiled with llvm-gcc4 2.3 (gcc 4.2.1) — Ollivier Robert <redmine@...>

Issue #340 has been reported by Ollivier Robert.

14 messages 2008/07/21

[#17943] RUBY_ENGINE? — "Vladimir Sizikov" <vsizikov@...>

Hi,

56 messages 2008/07/24
[#17950] Re: RUBY_ENGINE? — Tanaka Akira <akr@...> 2008/07/25

In article <3454c9680807241200xf7cc766qb987905a3987bb78@mail.gmail.com>,

[#17958] Re: RUBY_ENGINE? — "Vladimir Sizikov" <vsizikov@...> 2008/07/25

Hi,

[#17981] Re: RUBY_ENGINE? — Tanaka Akira <akr@...> 2008/07/26

In article <3454c9680807250054i70db563duf44b42d92ba41bfb@mail.gmail.com>,

[ruby-core:17768] [Ruby 1.8.7 - Bug #276] (Open) take_while functions inconsistently

From: Anonymous <redmine@...>
Date: 2008-07-14 20:44:29 UTC
List: ruby-core #17768
Issue #276 has been reported by Anonymous.

----------------------------------------
Bug #276: take_while functions inconsistently
http://redmine.ruby-lang.org/issues/show/276

Author: Anonymous
Status: Open
Priority: High
Assigned to: 
Category: 
Target version: 


take_while didn't work at all until 1.8.7 - I assume that is how it supposed to be. Perhaps that explains some of this behavior, too?

cards is an Array of Cards

pp cards:
[#<Card:0x179094 @suit="C", @value=4>,
 #<Card:0x1793b4 @suit="C", @value=3>,
 #<Card:0x177dd4 @suit="C", @value=10>,
 #<Card:0x177500 @suit="D", @value=13>,
 #<Card:0x1771e0 @suit="D", @value=14>,
 #<Card:0x1770c8 @suit="S", @value=14>,
 #<Card:0x177794 @suit="C", @value=12>]

suit = 'C'
cards = cards.take_while { |this_card| this_card.suit == suit }:
[#<Card:0x179094 @suit="C", @value=4>,
 #<Card:0x1793b4 @suit="C", @value=3>,
 #<Card:0x177dd4 @suit="C", @value=10>]

Note that #<Card:0x177794 @suit="C", @value=12> is not contained in the take_while although it is also 'C' for the suit.
For some reason, it also does not group the 4th 'C' together when sorted:

  def sortBySuit( cards = nil )
    if ! cards
      cards = @hand_check_cards
    end
    
    cards = cards.sort_by { |card| card.suit }    
  end

self.sortBySuit( cards )

So we try to grab another suit:

suit = 'S'
cards = cards.take_while { |this_card| this_card.suit == suit }:
[]

We end up with nothing.

Here is the Card class.

#!/usr/bin/env ruby

class Card
  
  attr_accessor :value, :suit

  @value
  @suit
  
  def initialize( value, suit )
    if value.is_a?(String)
      @value = value.to_i
    else
      @value = value
      pp value
      pp 'goda'
      exit
    end
    @suit = suit.to_s
  end
  
  def name

    case @value
      when 2 
        name = "2"
      when 3    
        name = "3"      
      when 4    
        name = "4"      
      when 5    
        name = "5"      
      when 6    
        name = "6"      
      when 7    
        name = "7"      
      when 8    
        name = "8"      
      when 9    
        name = "9"      
      when 10   
        name = "10"       
      when "T"    
        name = "10"
      when 11 # Jack
        name = "J"       
      when 12 # Queen
        name = "Q"       
      when 13 # King
        name = "K"       
      when 14 # Ace
        name = "A"      
    end
    return name + @suit
  end
  
  def next
    if @value == 14
      return 2
    else
      return @value + 1
    end
  end
  
  def prev
    if @value == 2
      return 14
    else
      return @value - 1
    end
  end
  
end

and here is where the Cards are initialized with their suits:
  def initCards()
    13.times do |this_time|
      index = this_time + 2
      @cards[index.to_s + 'D'] = Card.new( index.to_s, 'D' )
      @cards[index.to_s + 'C'] = Card.new( index.to_s, 'C' )
      @cards[index.to_s + 'S'] = Card.new( index.to_s, 'S' )
      @cards[index.to_s + 'H'] = Card.new( index.to_s, 'H' )
      @card_index.push( index.to_s + 'C' ) 
      @card_index.push( index.to_s + 'H' ) 
      @card_index.push( index.to_s + 'S' ) 
      @card_index.push( index.to_s + 'D' )
    end
  end

Am I doing something wrong? This seems like a bug. 

Asher (ahaig@penguinmilitia.net)


----------------------------------------
http://redmine.ruby-lang.org

In This Thread

Prev Next