Class: SetAttributes::DataSource::Hash

Inherits:
Object
  • Object
show all
Includes:
SetAttributes::DataSource
Defined in:
lib/set_attributes/data_source/hash.rb

Instance Attribute Summary

Attributes included from SetAttributes::DataSource

#source

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SetAttributes::DataSource

build_data_source, implementation, included, #initialize

Class Method Details

.verify_mapping(source, include) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/set_attributes/data_source/hash.rb', line 6

def self.verify_mapping(source, include)
  if include.nil?
    return source.keys
  end

  return include
end

Instance Method Details

#attribute?(attribute) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/set_attributes/data_source/hash.rb', line 19

def attribute?(attribute)
  source.keys.include?(attribute)
end

#get_value(attribute) ⇒ Object Also known as: []



14
15
16
# File 'lib/set_attributes/data_source/hash.rb', line 14

def get_value(attribute)
  source[attribute]
end