Sha256: 921dfe80d22590906c98e238661ecc2bf26d045c4584191c2e94b2b939cf0e81

Contents?: true

Size: 674 Bytes

Versions: 11

Compression:

Stored size: 674 Bytes

Contents

module PushType
  module Templatable
    extend ActiveSupport::Concern

    def template
      self.class.template_path
    end

    def template_args
      [template, self.class.template_opts.except!(:path)]
    end

    module ClassMethods

      def template(name, opts = {})
        @template_name = name
        @template_opts = opts
      end

      def template_name
        @template_name || self.name.underscore
      end

      def template_path
        File.join template_opts[:path], template_name
      end

      def template_opts
        { path: _ct.base_class.name.demodulize.pluralize.underscore }.merge(@template_opts || {})
      end

    end

  end  
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
push_type_core-0.5.3 app/models/concerns/push_type/templatable.rb
push_type_core-0.5.2 app/models/concerns/push_type/templatable.rb
push_type_core-0.5.1 app/models/concerns/push_type/templatable.rb
push_type_core-0.5.0 app/models/concerns/push_type/templatable.rb
push_type_core-0.5.0.alpha.5 app/models/concerns/push_type/templatable.rb
push_type_core-0.5.0.alpha.4 app/models/concerns/push_type/templatable.rb
push_type_core-0.5.0.alpha.3 app/models/concerns/push_type/templatable.rb
push_type_core-0.5.0.alpha.2 app/models/concerns/push_type/templatable.rb
push_type_core-0.5.0.alpha.1 app/models/concerns/push_type/templatable.rb
push_type_core-0.4.0 app/models/concerns/push_type/templatable.rb
push_type_core-0.4.0.beta.3 app/models/concerns/push_type/templatable.rb