module Zen::Service::Plugins::Attributes::ClassMethods
Public Instance Methods
attribute_methods()
click to toggle source
# File lib/zen/service/plugins/attributes.rb, line 65 def attribute_methods const_get(:AttributeMethods) end
attributes(*attrs)
click to toggle source
# File lib/zen/service/plugins/attributes.rb, line 69 def attributes(*attrs) attributes_list.concat(attrs) attrs.each do |name| attribute_methods.send(:define_method, name) { @attributes[name] } attribute_methods.send(:define_method, "#{name}?") { !!@attributes[name] } end end
attributes_list()
click to toggle source
# File lib/zen/service/plugins/attributes.rb, line 78 def attributes_list @attributes_list ||= [] end
from(service)
click to toggle source
# File lib/zen/service/plugins/attributes.rb, line 82 def from(service) new(service.send(:attributes)) end
inherited(service_class)
click to toggle source
Calls superclass method
# File lib/zen/service/plugins/attributes.rb, line 58 def inherited(service_class) service_class.const_set(:AttributeMethods, Module.new) service_class.send(:include, service_class::AttributeMethods) service_class.attributes_list.replace attributes_list.dup super end