Class: Capricorn::Satellite

Inherits:
Object
  • Object
show all
Includes:
Actions, Persistence, DRbUndumped
Defined in:
lib/capricorn/satellite.rb,
lib/capricorn/satellite/actions.rb,
lib/capricorn/satellite/persistence.rb,
lib/capricorn/satellite/dependency_loader.rb

Defined Under Namespace

Modules: Actions, Persistence Classes: DependencyLoader

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Persistence

#dump, #dump_file, included

Methods included from Actions

#add_engine, #remove_engine, #update_engine

Constructor Details

#initialize(domain) ⇒ Satellite

Returns a new instance of Satellite.



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/capricorn/satellite.rb', line 15

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

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



13
14
15
# File 'lib/capricorn/satellite.rb', line 13

def domain
  @domain
end

#enginesObject (readonly)

Returns the value of attribute engines.



13
14
15
# File 'lib/capricorn/satellite.rb', line 13

def engines
  @engines
end

Instance Method Details

#basedomainObject



27
28
29
30
31
32
33
34
# File 'lib/capricorn/satellite.rb', line 27

def basedomain
  unless @basedomain
    parts = self.domain.split('.')
    parts = parts[-2..-1]
    @basedomain = parts.join('.')
  end
  @basedomain
end

#subdomainObject



36
37
38
39
40
41
42
43
# File 'lib/capricorn/satellite.rb', line 36

def subdomain
  unless @subdomain
    parts = self.domain.split('.')
    parts = parts[0..-3]
    @subdomain = parts.join('.')
  end
  @subdomain unless @subdomain == ''
end

#subdomain?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/capricorn/satellite.rb', line 45

def subdomain?
  !self.subdomain.nil?
end