Sha256: 237e045f6aedd4c07fff5c505339fd9fbcdc6cc5268a745b3ae946b9050c89aa
Contents?: true
Size: 908 Bytes
Versions: 9
Compression:
Stored size: 908 Bytes
Contents
def attr_limited_regex_accessor(symbol, regex) class_eval %{ def #{symbol} @#{symbol} end def #{symbol}=(new_value) if new_value != nil && new_value !~ #{regex} raise "invalid #{symbol} format" end @#{symbol} = new_value end } end def attr_private_limited_regex_accessor(symbol, regex) class_eval %{ def #{symbol} @#{symbol} end private def #{symbol}=(new_value) if new_value != nil && new_value !~ #{regex} raise "invalid #{symbol} format" end @#{symbol} = new_value end } end def attr_private_accessor(symbol) class_eval %{ private def #{symbol} @#{symbol} end private def #{symbol}=(new_value) @#{symbol} = new_value end } end
Version data entries
9 entries across 9 versions & 2 rubygems