Sha256: 7ff7c7c044dd01ccb9b99337fb67e0d45212a8132041f1d605e68ace2b320962

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

module KCommercial
  module Resources

    class OCFileModel
      attr_accessor :header
      attr_accessor :implementation

      class << self
        def templates_root
          Pathname(__FILE__).parent.join('templates')
        end

        def public_header
          templates_root.join('{{component_header_name}}.h')
        end

        def public_model
          OCFileModel.new('{{component_header_name}}.h', nil)
        end

        def main_model
          OCFileModel.new('{{oc_class_name}}.h',
                          '{{oc_class_name}}.m')
        end

        def i18ns_model
          file_model_for_type('I18ns')
        end

        def fonts_model
          file_model_for_type('Fonts')
        end

        def images_model
          file_model_for_type('Images')
        end

        def files_model
          file_model_for_type('Files')
        end

        def colors_model
          file_model_for_type('Colors')
        end

        def file_model_for_type(type)
          OCFileModel.new("{{oc_class_name}}+#{type}.h",
                          "{{oc_class_name}}+#{type}.m")
        end
      end

      def initialize(header_name, imp_name)
        @header = OCFileModel.templates_root.join(header_name) if header_name
        @implementation = OCFileModel.templates_root.join(imp_name) if imp_name
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
KCommercialPipeline-0.2.5.1 lib/KCommercialPipeline/core/resource/objective-c/oc_file_model.rb