Class: WebpackDriver::Asset

Inherits:
Object
  • Object
show all
Defined in:
lib/webpack_driver/asset.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ Asset

Returns a new instance of Asset.



8
9
10
11
12
# File 'lib/webpack_driver/asset.rb', line 8

def initialize(attrs)
    @id   = attrs['id'].to_sym
    @size = attrs['size']
    @file = attrs['file']
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



5
6
7
# File 'lib/webpack_driver/asset.rb', line 5

def file
  @file
end

#has_source_mapObject

Returns the value of attribute has_source_map.



6
7
8
# File 'lib/webpack_driver/asset.rb', line 6

def has_source_map
  @has_source_map
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/webpack_driver/asset.rb', line 5

def id
  @id
end

#sizeObject (readonly)

Returns the value of attribute size.



5
6
7
# File 'lib/webpack_driver/asset.rb', line 5

def size
  @size
end

Class Method Details

.record(map, attrs) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/webpack_driver/asset.rb', line 14

def self.record(map, attrs)
    id = attrs['id'].to_sym
    file = attrs['file']
    if map[id] && file && file.end_with?('.map')
        map[id].has_source_map = true
    else
        map[id] = Asset.new(attrs)
    end
end