Sha256: da0ac7a8a1b0a56431fbf8984e642cc8211b74e138777189d9522a58f911718a

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

# encoding: utf-8
module CSD
  # This namespace holds all individual application Modules
  #
  module Application
    
    # This is the root class of all Applications
    #
    module Default
        
      def name
        ActiveSupport::Inflector.underscore self.to_s.demodulize
      end
      
      def description
        about.description
      end
      
      def human
        about.human
      end
      
      def actions
        about.actions
      end
      
      def scopes(action)
        about.scopes[:action]
      end
      
      def options(action='')
        options_dir      = File.join(Path.applications, name, 'options')
        common_file      = File.join(options_dir, "common.rb")
        specific_file    = File.join(options_dir, "#{action}.rb")
        common_options   = File.file?(common_file) ? File.read(common_file) : ''
        specific_options = File.file?(specific_file) ? File.read(specific_file) : ''
        specific_options + common_options
      end
      
      protected
      
      def about
        about_file = File.join(Path.applications, name, 'about.yml')
        OpenStruct.new YAML.load_file(about_file)
      end
      
    end
  end
end



Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
csd-0.1.4 lib/csd/application/default.rb
csd-0.1.3 lib/csd/application/default.rb