Class: DataProvider::Provider

Inherits:
Object
  • Object
show all
Defined in:
lib/data_provider/provider.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier, opts = {}, block = nil) ⇒ Provider



7
8
9
10
11
# File 'lib/data_provider/provider.rb', line 7

def initialize(identifier, opts = {}, block = nil)
  @identifier = identifier
  @options = opts.is_a?(Hash) ? opts : {}
  @block = block || Proc.new
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



5
6
7
# File 'lib/data_provider/provider.rb', line 5

def block
  @block
end

#identifierObject (readonly) Also known as: id

Returns the value of attribute identifier.



4
5
6
# File 'lib/data_provider/provider.rb', line 4

def identifier
  @identifier
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/data_provider/provider.rb', line 3

def options
  @options
end

Instance Method Details

#requirementsObject



15
16
17
# File 'lib/data_provider/provider.rb', line 15

def requirements
  [options[:requires]].flatten.compact
end