Sha256: a2f59f25d1cbe5a040a35054ea54f06e1bf890eb8a0ea773a013700a46e1f31f

Contents?: true

Size: 777 Bytes

Versions: 4

Compression:

Stored size: 777 Bytes

Contents

module Zertico
  class Service
    module ClassMethods
      attr_reader :interface_id, :interface_name, :interface_class, :resource_source

      def use_as_id(id)
        @interface_id = id
      end

      def use_as_variable_name(variable_name)
        @interface_name = variable_name
      end

      def use_interface(interface)
        @interface_class = interface
      end

      alias_method :use_model, :use_interface

      def resource_source=(resource_chain = [])
        @resource_source = Array(resource_chain).shift
        @resource_source = @resource_source.constantize if @resource_source.respond_to?(:constantize)
        resource_chain.each do |resource|
          @resource_source = @resource_source.send(resource)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zertico-2.0.0.beta.1 lib/zertico/service/class_methods.rb
zertico-2.0.0.alpha.3 lib/zertico/service/class_methods.rb
zertico-2.0.0.alpha.2 lib/zertico/service/class_methods.rb
zertico-2.0.0.alpha.1 lib/zertico/service/class_methods.rb