module BN::Helpers::HasAttributes::ClassMethods
The class methods to be mixed in when included.
Public Instance Methods
attribute(name, options={}, &block)
click to toggle source
# File lib/bn/helpers/has_attributes.rb, line 7 def attribute(name, options={}, &block) options = options.to_h attr_reader(name) define_method("#{name}=") do |value| value = instance_exec(value, options, &block) unless block.nil? instance_variable_set("@#{name}", value) end end