class Rack::LTI::Config
Constants
- DEFAULT
Public Class Methods
new(options = {}) { |self| ... }
click to toggle source
# File lib/rack/lti/config.rb, line 20 def initialize(options = {}) DEFAULT.merge(options).each { |k, v| self[k] = v } instance_eval { yield(self) } if block_given? end
Public Instance Methods
method_missing(method, *args, &block)
click to toggle source
Calls superclass method
# File lib/rack/lti/config.rb, line 53 def method_missing(method, *args, &block) if method.match(/=$/) self[method.to_s[0..-2].to_sym] = args.first elsif self.has_key?(method) self[method] else super end end
public?()
click to toggle source
# File lib/rack/lti/config.rb, line 37 def public? self[:consumer_key].nil? && self[:consumer_secret].nil? end
to_xml(request, options = {})
click to toggle source
# File lib/rack/lti/config.rb, line 41 def to_xml(request, options = {}) options = options.merge(get_extensions(request)) # Stringify keys for IMS::LTI config = self.merge(options).inject({}) do |h, v| h[v[0].to_s] = v[1] h end IMS::LTI::ToolConfig.new(config).to_xml(indent: 2) end
Private Instance Methods
get_extensions(request)
click to toggle source
# File lib/rack/lti/config.rb, line 65 def get_extensions(request) return {} unless self.key? :extensions extensions = self[:extensions].inject({}) do |h, (k, v)| h[k] = v.respond_to?(:call) ? v.call(request) : v h end { extensions: extensions } end