Class: Shrinker::Parser::Abstract

Inherits:
Struct
  • Object
show all
Defined in:
lib/shrinker/parser/abstract.rb

Direct Known Subclasses

Mime, Text, Url

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content = nil, attributes = nil, config = nil) ⇒ Abstract

Returns a new instance of Abstract.



11
12
13
14
# File 'lib/shrinker/parser/abstract.rb', line 11

def initialize(content = nil, attributes = nil, config = nil)
  super(content, attributes)
  merge_config(config)
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes

Returns:

  • (Object)

    the current value of attributes



3
4
5
# File 'lib/shrinker/parser/abstract.rb', line 3

def attributes
  @attributes
end

#configObject (readonly)

Returns the value of attribute config.



4
5
6
# File 'lib/shrinker/parser/abstract.rb', line 4

def config
  @config
end

#contentObject

Returns the value of attribute content

Returns:

  • (Object)

    the current value of content



3
4
5
# File 'lib/shrinker/parser/abstract.rb', line 3

def content
  @content
end

Class Method Details

.replace(content, attributes = {}, config = nil) ⇒ Object

Delegate replace to an instance



7
8
9
# File 'lib/shrinker/parser/abstract.rb', line 7

def self.replace(content, attributes = {}, config = nil)
  self.new(content, attributes, config).replace
end

Instance Method Details

#replaceObject



16
17
18
# File 'lib/shrinker/parser/abstract.rb', line 16

def replace
  raise "Shrinker::Parser::Abstract.replace not implemented"
end