Sha256: 7659f3e712ee2a1a844d73b2fc132c4b5948c6875b48eea7d40cb78d9786412c

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

require "active_support/concern"

require "building_sync_tk/factory"
require "building_sync_tk/inflector"

require "isomorphic/model"

module BuildingSyncTk
  # @see Isomorphic::Model
  module Model
    extend ::ActiveSupport::Concern

    included do
      include ::Isomorphic::Model
    end

    class_methods do
      # @!scope class

      # Define an isomorphism for the given class and optional alias name.
      #
      # @param isomorphism_class [Class] the class for the isomorphism
      # @param method_suffix [#to_s] the optional alias name for the isomorphism
      # @param options [Hash<Symbol, Object>] the options
      # @option options [Boolean] :allow_blank (false) +true+ if the root node should always return a non-+nil+ target
      # @option options [Hash<Symbol, Object>] :attributes ({}) default attributes for the target
      # @option options [Boolean] :collection (false) +true+ if the target is a collection
      # @yieldparam node [Isomorphic::Node::Root] the root node
      # @yieldreturn [void]
      # @return [void]
      # @raise [Isomorphic::InflectorError] if an inflectable term is invalid
      def building_sync_for(*args, &block)
        isomorphism_for(BuildingSyncTk::Factory.instance, BuildingSyncTk::Inflector.instance, *args, &block)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
building_sync_rails-0.1.1 lib/building_sync_tk/model.rb
building_sync_rails-0.1.0 lib/building_sync_tk/model.rb