module RandomAttributes::ClassMethods
Public Instance Methods
after_parse(*args, &block)
click to toggle source
# File lib/random_attributes.rb, line 124 def after_parse(*args, &block) set_callback(:parse, :after, *args, &block) end
attribute(attrs, options = {})
click to toggle source
# File lib/random_attributes.rb, line 98 def attribute(attrs, options = {}) register = Register.new attrs, options attribute_register[register.aliased] = register define_method register.aliased do get_attribute register end define_method :"#{register.aliased}=" do |value| set_attribute register.aliased, value end end
attribute_register()
click to toggle source
# File lib/random_attributes.rb, line 112 def attribute_register @_attribute_register ||= {} end
before_parse(*args, &block)
click to toggle source
# File lib/random_attributes.rb, line 120 def before_parse(*args, &block) set_callback(:parse, :before, *args, &block) end
parse(attributes)
click to toggle source
# File lib/random_attributes.rb, line 116 def parse(attributes) new.parse attributes end