Class: Supertramp

Inherits:
Object
  • Object
show all
Defined in:
lib/supertramp.rb,
lib/supertramp/avatar.rb,
lib/supertramp/config.rb,
lib/supertramp/version.rb

Defined Under Namespace

Classes: Avatar, Config

Constant Summary collapse

VERSION =
'0.8.2'
@@config =
Config.new

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(initials: nil, name: nil, background: nil, shape: nil) ⇒ Supertramp

Returns a new instance of Supertramp.



12
13
14
15
16
17
18
19
# File 'lib/supertramp.rb', line 12

def initialize(initials: nil, name: nil, background: nil, shape: nil)
  @initials = initials
  @name = name
  @background = background
  @shape = shape

  validate_arguments
end

Class Method Details

.configure {|@@config| ... } ⇒ Object

Yields:

  • (@@config)


37
38
39
# File 'lib/supertramp.rb', line 37

def self.configure
  yield @@config
end

.data_url(**options) ⇒ Object



33
34
35
# File 'lib/supertramp.rb', line 33

def self.data_url(**options)
  new(**options).data_url
end

.svg(**options) ⇒ Object



29
30
31
# File 'lib/supertramp.rb', line 29

def self.svg(**options)
  new(**options).to_s
end

Instance Method Details

#data_urlObject



25
26
27
# File 'lib/supertramp.rb', line 25

def data_url
  avatar.data_url
end

#to_sObject



21
22
23
# File 'lib/supertramp.rb', line 21

def to_s
  avatar.svg
end