Sha256: 57ea2dcdd9aeb89db489e18285d3b11c3735d06d25f00d73d53730f98b7959eb

Contents?: true

Size: 1.16 KB

Versions: 18

Compression:

Stored size: 1.16 KB

Contents

module Capricorn
  class Satellite
    include DRbUndumped
    
    autoload :Actions,          File.dirname(__FILE__)+'/satellite/actions'
    autoload :Persistence,      File.dirname(__FILE__)+'/satellite/persistence'
    autoload :DependencyLoader, File.dirname(__FILE__)+'/satellite/dependency_loader'
    
    include Capricorn::Satellite::Actions
    include Capricorn::Satellite::Persistence
    
    attr_reader :domain, :engines
    
    def initialize(domain)
      if Hash === domain
        domain.each do |name, value|
          instance_variable_set("@#{name}".to_sym, value)
        end
      else
        @domain = domain
        @engines = {}
      end
      @domain.gsub!(/^www\./, '')
    end
    
    def basedomain
      unless @basedomain
        parts = self.domain.split('.')
        parts = parts[-2..-1]
        @basedomain = parts.join('.')
      end
      @basedomain
    end
    
    def subdomain
      unless @subdomain
        parts = self.domain.split('.')
        parts = parts[0..-3]
        @subdomain = parts.join('.')
      end
      @subdomain unless @subdomain == ''
    end
    
    def subdomain?
      !self.subdomain.nil?
    end
    
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
simonmenke-capricorn-0.2.03 lib/capricorn/satellite.rb
simonmenke-capricorn-0.2.07 lib/capricorn/satellite.rb
capricorn-0.2.16 lib/capricorn/satellite.rb
capricorn-0.2.15 lib/capricorn/satellite.rb
capricorn-0.2.14 lib/capricorn/satellite.rb
capricorn-0.2.13 lib/capricorn/satellite.rb
capricorn-0.2.12 lib/capricorn/satellite.rb
capricorn-0.2.11 lib/capricorn/satellite.rb
capricorn-0.2.10 lib/capricorn/satellite.rb
capricorn-0.2.09 lib/capricorn/satellite.rb
capricorn-0.2.08 lib/capricorn/satellite.rb
capricorn-0.2.07 lib/capricorn/satellite.rb
capricorn-0.2.06 lib/capricorn/satellite.rb
capricorn-0.2.05 lib/capricorn/satellite.rb
capricorn-0.2.04 lib/capricorn/satellite.rb
capricorn-0.2.03 lib/capricorn/satellite.rb
capricorn-0.2.02 lib/capricorn/satellite.rb
capricorn-0.2.01 lib/capricorn/satellite.rb