Actions
Bug #12177
closedUsing `if:` as symbol in hash with new hash syntax in irb console is not working
Bug #12177: Using `if:` as symbol in hash with new hash syntax in irb console is not working
Description
Try running irb and past this in:
# This works class TestClass @_alerts_config = {} class << self attr_accessor :_alerts_config end def self.monitor value_name, *args self._alerts_config[value_name] = args.first end monitor "test_attr", alert: "test@example.com", :if => Proc.new{|instance| instance.nil? }, with_message: "Some error" end This will work. However if the :if => is changed to if: then the syntax renders invalid.
# This does NOT work class TestClass @_alerts_config = {} class << self attr_accessor :_alerts_config end def self.monitor value_name, *args self._alerts_config[value_name] = args.first end monitor "test_attr", alert: "test@example.com", if: Proc.new{|instance| instance.nil? }, with_message: "Some error" end
Updated by shyouhei (Shyouhei Urabe) over 9 years ago
- Status changed from Open to Assigned
- Assignee set to keiju (Keiju Ishitsuka)
Updated by nobu (Nobuyoshi Nakada) almost 9 years ago
- Has duplicate Bug #13012: irb fails to define a method with a reserved-word-ish keyword argument added
Updated by nobu (Nobuyoshi Nakada) almost 9 years ago
- Status changed from Assigned to Closed
Actions