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.



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

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.



3
4
5
# File 'lib/flipper/export.rb', line 3

def contents
  @contents
end

#formatObject (readonly)

Returns the value of attribute format.



3
4
5
# File 'lib/flipper/export.rb', line 3

def format
  @format
end

#versionObject (readonly)

Returns the value of attribute version.



3
4
5
# File 'lib/flipper/export.rb', line 3

def version
  @version
end

Instance Method Details

#adapterObject



15
16
17
# File 'lib/flipper/export.rb', line 15

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

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

Returns:

  • (Boolean)


19
20
21
# File 'lib/flipper/export.rb', line 19

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

#featuresObject

Raises:

  • (NotImplementedError)


11
12
13
# File 'lib/flipper/export.rb', line 11

def features
  raise NotImplementedError
end