Class: Symbol
Instance Method Summary collapse
-
#validate_lvar_type! { ... } ⇒ true
Validates the type of a local variable.
Instance Method Details
#validate_lvar_type! { ... } ⇒ true
Validates the type of a local variable.
112 113 114 115 116 117 118 119 |
# File 'lib/golly-utils/ruby_ext/classes_and_types.rb', line 112 def validate_lvar_type!(&block) name= self raise "You must provide a block that returns one or more valid classes for #{name}." unless block classes= [block.()].flatten v= block.send(:binding).eval(name.to_s) v.validate_type! name, *classes true end |