Class: Confetti::Config::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/confetti/config/image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Image

Returns a new instance of Image.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/confetti/config/image.rb', line 7

def initialize *args
  @src = args.shift
  @height = args.shift
  @width = args.shift

  @extras   = (args.shift || {}).reject do |name, val|
    %w{src height width}.include?(name)
  end

  @role     = @extras['role']
  @platform = @extras['platform']
  @main     = @extras['main']
  @density  = @extras['density']
  @state    = @extras['state']
  @keep_original = @extras['keepOriginal']
end

Instance Attribute Details

#densityObject

Returns the value of attribute density.



4
5
6
# File 'lib/confetti/config/image.rb', line 4

def density
  @density
end

#extrasObject

Returns the value of attribute extras.



4
5
6
# File 'lib/confetti/config/image.rb', line 4

def extras
  @extras
end

#heightObject

Returns the value of attribute height.



4
5
6
# File 'lib/confetti/config/image.rb', line 4

def height
  @height
end

#keep_originalObject

Returns the value of attribute keep_original.



4
5
6
# File 'lib/confetti/config/image.rb', line 4

def keep_original
  @keep_original
end

#mainObject

Returns the value of attribute main.



4
5
6
# File 'lib/confetti/config/image.rb', line 4

def main
  @main
end

#platformObject

Returns the value of attribute platform.



4
5
6
# File 'lib/confetti/config/image.rb', line 4

def platform
  @platform
end

#roleObject

Returns the value of attribute role.



4
5
6
# File 'lib/confetti/config/image.rb', line 4

def role
  @role
end

#srcObject

Returns the value of attribute src.



4
5
6
# File 'lib/confetti/config/image.rb', line 4

def src
  @src
end

#stateObject

Returns the value of attribute state.



4
5
6
# File 'lib/confetti/config/image.rb', line 4

def state
  @state
end

#widthObject

Returns the value of attribute width.



4
5
6
# File 'lib/confetti/config/image.rb', line 4

def width
  @width
end

Instance Method Details

#defined_attrsObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/confetti/config/image.rb', line 24

def defined_attrs
  {
      "src" => @src,
      "height" => @height,
      "width" => @width,
      "gap:role" => @role,
      "gap:platform" => @platform,
      "gap:main" => @main,
      "gap:density" => @density,
      "gap:state" => @state,
      "gap:keepOriginal" => @keep_original
  }
end