Class: JsonUpdater::JsonTypeDetector
- Inherits:
-
Object
- Object
- JsonUpdater::JsonTypeDetector
- Defined in:
- lib/json_updater/json_type_detector.rb
Instance Attribute Summary collapse
-
#json_changeable ⇒ Object
readonly
Returns the value of attribute json_changeable.
Class Method Summary collapse
Instance Method Summary collapse
- #detect_type ⇒ Object
-
#initialize(json_changeable) ⇒ JsonTypeDetector
constructor
A new instance of JsonTypeDetector.
Constructor Details
#initialize(json_changeable) ⇒ JsonTypeDetector
Returns a new instance of JsonTypeDetector.
11 12 13 |
# File 'lib/json_updater/json_type_detector.rb', line 11 def initialize(json_changeable) @json_changeable = json_changeable end |
Instance Attribute Details
#json_changeable ⇒ Object (readonly)
Returns the value of attribute json_changeable.
5 6 7 |
# File 'lib/json_updater/json_type_detector.rb', line 5 def json_changeable @json_changeable end |
Class Method Details
.detect_type(json_changeable) ⇒ Object
7 8 9 |
# File 'lib/json_updater/json_type_detector.rb', line 7 def self.detect_type(json_changeable) new(json_changeable).detect_type end |
Instance Method Details
#detect_type ⇒ Object
15 16 17 18 19 20 21 |
# 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 |