Sha256: 5697d4ce6d5028801b5ab7dc5cb4226594944a7a10241400a385d7daa7a84e25

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

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

4 entries across 4 versions & 1 rubygems

Version Path
csd-0.1.2 lib/csd/application/default.rb
csd-0.1.1 lib/csd/application/default.rb
csd-0.1.0 lib/csd/application/default.rb
csd-0.0.16 lib/csd/application/default.rb