Sha256: e8bd622879432f887d9f18604236a25e12b7d9bea16996a83fee0e47f0c0e149
Contents?: true
Size: 1.42 KB
Versions: 22
Compression:
Stored size: 1.42 KB
Contents
module EventbriteSDK class Resource module Operations module AttributeSchema module ClassMethods attr_reader :prefix, :schema def schema_definition(&block) @schema = SchemaDefinition.new(name) @schema.instance_eval(&block) end def attributes_prefix(prefix) @prefix = prefix end end module InstanceMethods %i(changes changed?).each do |method| define_method(method) { attrs.public_send(method) } end %i([] assign_attributes).each do |method| define_method(method) { |arg| attrs.public_send(method, arg) } end def build_attrs(new_attrs) @attrs = Attributes.new( new_attrs, self.class.schema || NullSchemaDefinition.new ) end private def method_missing(method_name, *_args, &_block) if attrs.respond_to?(method_name) attrs.public_send(method_name) else super end end def respond_to_missing?(method_name, _include_private = false) attrs.respond_to?(method_name) || super end attr_reader :attrs end def self.included(receiver) receiver.extend ClassMethods receiver.prepend InstanceMethods end end end end end
Version data entries
22 entries across 22 versions & 1 rubygems