Class: DomainSwitcher::Website

Inherits:
Object
  • Object
show all
Includes:
ConfigBuilder
Defined in:
lib/domain_switcher/website.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ConfigBuilder

#build_config!, #method_missing

Constructor Details

#initialize(name, symbol, conf = {}, domains = []) ⇒ Website

Returns a new instance of Website.



10
11
12
13
14
15
16
# File 'lib/domain_switcher/website.rb', line 10

def initialize(name, symbol, conf = {}, domains = [])
  @name = name
  @symbol = symbol
  @domains = domains
  @domains_hash = {}
  build_config!(conf)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class DomainSwitcher::ConfigBuilder

Instance Attribute Details

#default_domainObject

Returns the value of attribute default_domain.



8
9
10
# File 'lib/domain_switcher/website.rb', line 8

def default_domain
  @default_domain
end

#domainsObject (readonly)

Returns the value of attribute domains.



7
8
9
# File 'lib/domain_switcher/website.rb', line 7

def domains
  @domains
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/domain_switcher/website.rb', line 5

def name
  @name
end

#symbolObject (readonly)

Returns the value of attribute symbol.



6
7
8
# File 'lib/domain_switcher/website.rb', line 6

def symbol
  @symbol
end

Instance Method Details

#<<(domain) ⇒ Object



18
19
20
21
# File 'lib/domain_switcher/website.rb', line 18

def <<(domain)
  @domains_hash[domain.domain] = domain
  @domains << domain
end

#[](domain) ⇒ Object

Retrieve a domain by the domain



24
25
26
# File 'lib/domain_switcher/website.rb', line 24

def [](domain)
  @domains_hash[domain]
end