class JsonUpdater::JsonTypeDetector
Attributes
json_changeable[R]
Public Class Methods
detect_type(json_changeable)
click to toggle source
# File lib/json_updater/json_type_detector.rb, line 7 def self.detect_type(json_changeable) new(json_changeable).detect_type end
new(json_changeable)
click to toggle source
# File lib/json_updater/json_type_detector.rb, line 11 def initialize(json_changeable) @json_changeable = json_changeable end
Public Instance Methods
detect_type()
click to toggle source
# File lib/json_updater/json_type_detector.rb, line 15 def detect_type if one_level_json? JsonUpdater::OneLevelJsonBuilder elsif one_level_json_array? JsonUpdater::OneLevelJsonArrayBuilder end end
Private Instance Methods
one_level_json?()
click to toggle source
# File lib/json_updater/json_type_detector.rb, line 25 def one_level_json? json_changeable.is_a?(Hash) end
one_level_json_array?()
click to toggle source
# File lib/json_updater/json_type_detector.rb, line 29 def one_level_json_array? json_changeable.is_a?(Array) end