Sha256: 056157921483b137b6b9ac3a541bb7be9d48fd53abd8148d028883f877386bcf
Contents?: true
Size: 662 Bytes
Versions: 13
Compression:
Stored size: 662 Bytes
Contents
module Cranium::AttributeDSL def define_attribute(name) class_eval <<-attribute_method def #{name}(*args) return @#{name} if args.count.zero? @#{name} = args.first end attribute_method end def define_array_attribute(name) class_eval <<-attribute_method def #{name}(*args) return @#{name} || [] if args.count.zero? @#{name} = args end attribute_method end def define_boolean_attribute(name) class_eval <<-attribute_method def #{name}(*args) return !!@#{name} if args.count.zero? @#{name} = !!args end attribute_method end end
Version data entries
13 entries across 13 versions & 1 rubygems