Module: AttrReadonly
- Included in:
- Module
- Defined in:
- lib/attr_readonly.rb,
lib/attr_readonly/version.rb
Overview
Note:
this module include a method to be mix in Module (Class)
module Methodic
Constant Summary collapse
- VERSION =
current version of attr_readonly
"1.0.0"
Instance Method Summary collapse
-
#attr_readonly(*syms) ⇒ Array
pretty accessor for specifying mandatories options.
Instance Method Details
#attr_readonly(*syms) ⇒ Array
pretty accessor for specifying mandatories options
36 37 38 39 40 41 42 |
# File 'lib/attr_readonly.rb', line 36 def attr_readonly *syms syms.each do |method| define_method(method){ return self.instance_variable_get("@#{method.to_s}").dup.freeze } end end |