Class: Flipper::Export

Inherits:
Object
  • Object
show all
Defined in:
lib/flipper/export.rb

Direct Known Subclasses

Flipper::Exporters::Json::Export

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contents:, format: :json, version: 1) ⇒ Export

Returns a new instance of Export.



7
8
9
10
11
# File 'lib/flipper/export.rb', line 7

def initialize(contents:, format: :json, version: 1)
  @contents = contents
  @format = format
  @version = version
end

Instance Attribute Details

#contentsObject (readonly)

Returns the value of attribute contents.



5
6
7
# File 'lib/flipper/export.rb', line 5

def contents
  @contents
end

#formatObject (readonly)

Returns the value of attribute format.



5
6
7
# File 'lib/flipper/export.rb', line 5

def format
  @format
end

#versionObject (readonly)

Returns the value of attribute version.



5
6
7
# File 'lib/flipper/export.rb', line 5

def version
  @version
end

Instance Method Details

#adapterObject



17
18
19
# File 'lib/flipper/export.rb', line 17

def adapter
  @adapter ||= Flipper::Adapters::Memory.new(features)
end

#eql?(other) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


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

def eql?(other)
  self.class.eql?(other.class) && @contents == other.contents && @format == other.format && @version == other.version
end

#featuresObject

Raises:

  • (NotImplementedError)


13
14
15
# File 'lib/flipper/export.rb', line 13

def features
  raise NotImplementedError
end