Class: Capistrano::Calendar::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano/calendar/configuration.rb

Class Method Summary collapse

Class Method Details

.collect(hash) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/capistrano/calendar/configuration.rb', line 8

def self.collect(hash)
  [
    :calendar_verbose,
    :calendar_logfile,
    :calendar_foreground,

    :calendar_service,
    :calendar_username,
    :calendar_password,

    :calendar_name,
    :calendar_summary,
    :calendar_location,
    :calendar_timezone,
    :calendar_color,

    :calendar_event_name,
    :calendar_event_summary,
    :calendar_event_location,
    :calendar_event_time,
    :calendar_event_status,
  ].inject({}) { |result, key|
    result[key] = hash[key] if hash.exists?(key)
    result
  }
end

.decode(string) ⇒ Object



39
40
41
# File 'lib/capistrano/calendar/configuration.rb', line 39

def self.decode(string)
  YAML.load(Base64.decode64(string))
end

.encode(hash) ⇒ Object



35
36
37
# File 'lib/capistrano/calendar/configuration.rb', line 35

def self.encode(hash)
  Base64.encode64(hash.to_yaml).gsub("\n", '')
end