Postings by RRRoy BBBean

Keyword arguments with symbol as default value

I need to use a Ruby symbol as the default value for an argument, but I
also want to use keyword arguments,  because they are so neat.

I found that wrapping the symbol in in parenthesis or using a constant
to refer to the symbol works.

Is there a better way to do this with Ruby 2.6+ (and still have a symbol
as the default value)?

def mymethod myarg:(:mydefaultsymbol)

    p myarg


# or

DEFAULT_MYVALUE = :mydefaultsymbol

def mymethod myarg:DEFAULT_MYVALUE

    p myarg


# where, in either case, mymethod # outputs :mydefaultsymbol

Unsubscribe: <mailto:ruby-talk-request@ruby

How do you feel about utf-8 in ruby code?

Is this acceptable?

'a⟶b'.to_sym == :a⟶b

Granted, this is a simplistic example, but how do you feel about using
utf-8 in the ruby code itself?

Unsubscribe: <>

Ruby-only way to access local copy of Ruby documentation using local web server?

Is there a Ruby-only way to access a local copy of Ruby documentation
using a local web server? I don't have Apache or any other web server

1. I download the official Ruby documentation from
<a href="" title=""></a>

2. I unpack the documentation as hierarchical directories of web files
into ./ruby_2_6_core/ and ./ruby_2_6_stdlib/


Regular Expression UTF-8 Alphanumeric+Whitespace Match, Ignore Embedded Punctuation

I do a lot of work with a mix of English and Korean UTF-8 text. I need a
regular expression to match both English and Korean (multi-byte) text.

Improving Ruby Bitwise Operations

There is a ruby gem for bitwise operations, by Kenn Ejima, although it
has not been updated in 4 years.

<a href="" title=""></a>
<a href="" title=""></a>

I believe that the better approach for Ruby Bitwise Operations is to
"dust-off" this "bitwise" gem and add whatever functionality is needed.
That might include a ".mask" method, which returns true (if any
resulting bit is 1) or false (if all resulting bits are 0).