Class: IMS::LTI::Models::Parameter

Inherits:
LTIModel
  • Object
show all
Defined in:
lib/ims/lti/models/parameter.rb

Constant Summary

Constants inherited from LTIModel

LTIModel::LTI_VERSION_2P0, LTIModel::LTI_VERSION_2P1

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LTIModel

add_attribute, add_attributes, #as_json, #attributes, #attributes=, #from_json, from_json, inherit_attributes, inherited, #initialize, #method_missing, #to_json

Constructor Details

This class inherits a constructor from IMS::LTI::Models::LTIModel

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class IMS::LTI::Models::LTIModel

Class Method Details

.process_params(parameters, lookup_hash) ⇒ Object



10
11
12
13
14
15
# File 'lib/ims/lti/models/parameter.rb', line 10

def self.process_params(parameters, lookup_hash)
  [*parameters].inject({}) do |hash, param|
    hash[param.name] = param.fixed? ? param.fixed : expand_variable(lookup_hash[param.variable]) || '$' + param.variable
    hash
  end
end

Instance Method Details

#==(obj) ⇒ Object



17
18
19
# File 'lib/ims/lti/models/parameter.rb', line 17

def ==(obj)
  self.fixed? == obj.fixed? && self.name == obj.name && self.fixed == obj.fixed
end

#fixed?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/ims/lti/models/parameter.rb', line 6

def fixed?
  !fixed.nil? && fixed.to_s.strip != ''
end