Sha256: 14990a8d6f4c0e1ba2237a099116e98693e9d4fcc464cacf9fe68b94ffb446d1
Contents?: true
Size: 795 Bytes
Versions: 8
Compression:
Stored size: 795 Bytes
Contents
require 'resource_kit/inheritable_attribute' module ResourceKit class Resource extend InheritableAttribute inheritable_attr :_resources attr_reader :connection, :scope def initialize(connection: nil, scope: nil) @connection = connection @scope = scope end def self.resources(&block) self._resources ||= ResourceCollection.new if block_given? self._resources.instance_eval(&block) MethodFactory.construct(self, self._resources) end self._resources end def action(name) _resources.find_action(name) end def action_and_connection(action_name) ActionConnection.new(action(action_name), connection) end private def _resources self.class._resources end end end
Version data entries
8 entries across 8 versions & 1 rubygems