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.
Thibaut B. (Guest)
on 2009-03-25 11: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
Jimmy S. (Guest)
on 2009-03-25 19:23
(Received via mailing list)
IronRuby should support this. Enum values are ints anyway, so that
behavior shouldn't be hard to implement.
________________________________
From: removed_email_address@domain.invalid
[removed_email_address@domain.invalid] on behalf of Thibaut Barrère
[removed_email_address@domain.invalid]
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
Tomas M. (Guest)
on 2009-03-25 19:28
(Received via mailing list)
Yes, we can do that.

Tomas

From: removed_email_address@domain.invalid
[mailto:removed_email_address@domain.invalid] 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
Thibaut B. (Guest)
on 2009-03-26 18: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
Thibaut B. (Guest)
on 2009-03-30 01: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
Thibaut B. (Guest)
on 2009-05-27 01: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
Jimmy S. (Guest)
on 2009-06-17 10: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: removed_email_address@domain.invalid
[mailto:removed_email_address@domain.invalid] On Behalf Of Thibaut
Barrère
Sent: Tuesday, May 26, 2009 2:38 PM
To: removed_email_address@domain.invalid
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
Thibaut B. (Guest)
on 2009-06-17 11: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.