Forum: IronRuby Flagged enums

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
91eb330fb36d1e03c856574dfb77d2bc?d=identicon&s=25 Thibaut Barrère (thbar)
on 2009-03-25 10:42
(Received via mailing list)
Hi,
it seems that the following code isn't supported:

AnchorStyles.Bottom | AnchorStyles.Left

I believe IronPython supports this (see EnumOps.cs).

Is that syntax planned ?

-- Thibaut
E1deaac6561498a0e7472e6268ea9ccc?d=identicon&s=25 Jimmy Schementi (Guest)
on 2009-03-25 18:23
(Received via mailing list)
IronRuby should support this. Enum values are ints anyway, so that
behavior shouldn't be hard to implement.
________________________________
From: ironruby-core-bounces@rubyforge.org
[ironruby-core-bounces@rubyforge.org] on behalf of Thibaut Barrère
[thibaut.barrere@gmail.com]
Sent: Wednesday, March 25, 2009 2:39 AM
To: ironruby-core
Subject: [Ironruby-core] Flagged enums

Hi,

it seems that the following code isn't supported:

AnchorStyles.Bottom | AnchorStyles.Left

I believe IronPython supports this (see EnumOps.cs).

Is that syntax planned ?

-- Thibaut
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2009-03-25 18:28
(Received via mailing list)
Yes, we can do that.

Tomas

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Thibaut
Barrère
Sent: Wednesday, March 25, 2009 2:39 AM
To: ironruby-core
Subject: [Ironruby-core] Flagged enums

Hi,

it seems that the following code isn't supported:

AnchorStyles.Bottom | AnchorStyles.Left

I believe IronPython supports this (see EnumOps.cs).

Is that syntax planned ?

-- Thibaut
91eb330fb36d1e03c856574dfb77d2bc?d=identicon&s=25 Thibaut Barrère (thbar)
on 2009-03-26 17:41
(Received via mailing list)
>
> Yes, we can do that.
>
> thanks for the answer.

I'll try to create some code to handle that manually until then.

cheers,

-- Thibaut
91eb330fb36d1e03c856574dfb77d2bc?d=identicon&s=25 Thibaut Barrère (thbar)
on 2009-03-29 23:53
(Received via mailing list)
In case it's useful to someone else (until flagged enums combination is
supported by IronRuby), I wrote some custom code to support that.
I'm now allowing code like :anchor => [:bottom,:top] in Magic.

Relevant code is here:
-
http://github.com/thbar/magic/commit/e236e6fa455ea...
-
http://github.com/thbar/magic/blob/e236e6fa455ea78...

cheers,

-- Thibaut
91eb330fb36d1e03c856574dfb77d2bc?d=identicon&s=25 Thibaut Barrère (thbar)
on 2009-05-26 23:46
(Received via mailing list)
Hi,

a follow-up on flagged enums:

>> AnchorStyles.Bottom | AnchorStyles.Left

I seem to remember a commit that mentioned it was supported, but I'm not
sure.

Currently, either "||" or "|" fail on this example (| gives method
undefined, || returns only Bottom).

Has it been implemented ? Should I file a bug for this ? (or is the
syntax
different ?)

cheers,

--Thibaut
E1deaac6561498a0e7472e6268ea9ccc?d=identicon&s=25 Jimmy Schementi (Guest)
on 2009-06-17 08:59
(Received via mailing list)
This works now:

>>> AnchorStyles.bottom | AnchorStyles.left
=> Bottom, Left

Jim, there should be specs for this. Where should I add them?
enum/mapping_spec.rb or somewhere else?

From: ironruby-core-bounces@rubyforge.org
[mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Thibaut
Barrère
Sent: Tuesday, May 26, 2009 2:38 PM
To: ironruby-core@rubyforge.org
Subject: Re: [Ironruby-core] Flagged enums


Hi,

a follow-up on flagged enums:

>> AnchorStyles.Bottom | AnchorStyles.Left

I seem to remember a commit that mentioned it was supported, but I'm not
sure.

Currently, either "||" or "|" fail on this example (| gives method
undefined, || returns only Bottom).

Has it been implemented ? Should I file a bug for this ? (or is the
syntax different ?)

cheers,

--Thibaut
91eb330fb36d1e03c856574dfb77d2bc?d=identicon&s=25 Thibaut Barrère (thbar)
on 2009-06-17 09:11
(Received via mailing list)
Hi,

This works now:
>
> >>> AnchorStyles.bottom | AnchorStyles.left
>
> => Bottom, Left
>

thanks!

-- Thibaut
This topic is locked and can not be replied to.