class Circuitdata::Profile
Constants
- BASIC_PROFILE_STRUCTURE
Public Class Methods
new(data:)
click to toggle source
# File lib/circuitdata/profile.rb, line 17 def initialize(data:) @data = data end
questions()
click to toggle source
# File lib/circuitdata/profile.rb, line 13 def self.questions Schema.profile_questions end
Public Instance Methods
data()
click to toggle source
# File lib/circuitdata/profile.rb, line 21 def data @data ||= setup_basic_data end
profile_data()
click to toggle source
# File lib/circuitdata/profile.rb, line 25 def profile_data data.dig(:open_trade_transfer_package, :profiles) end
question_answer(path)
click to toggle source
# File lib/circuitdata/profile.rb, line 29 def question_answer(path) path = path.map { |p| p.is_a?(String) ? p.to_sym : p } profile_data.dig(*path) end
set_question_answer(path, value)
click to toggle source
# File lib/circuitdata/profile.rb, line 34 def set_question_answer(path, value) path = path.map { |p| p.is_a?(String) ? p.to_sym : p } return if value.nil? && question_answer(path).nil? Bury.bury(profile_data, *path, value) end
Private Instance Methods
setup_basic_data()
click to toggle source
# File lib/circuitdata/profile.rb, line 42 def setup_basic_data BASIC_PROFILE_STRUCTURE.deep_dup end