lib/applix/oattr.rb in applix-0.2.1 vs lib/applix/oattr.rb in applix-0.2.2
- old
+ new
@@ -3,13 +3,14 @@
base.extend ClassMethods
end
module ClassMethods
def oattr *names
- container = "@options"
- if names.last.kind_of? Hash
- container = "@#{(names.pop)[:container]}"
- end
+ container = if names.last.kind_of? Hash
+ "@#{(names.pop)[:container]}"
+ else
+ "@options"
+ end
names.each do |name|
class_eval "def #{name}; #{container}['#{name}'.to_sym]; end"
end
end
end