Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Welcome: format option #29

Merged
merged 6 commits into from
Feb 23, 2020
Merged

Welcome: format option #29

merged 6 commits into from
Feb 23, 2020

Conversation

YusukeHosonuma
Copy link
Owner

@YusukeHosonuma YusukeHosonuma commented Feb 21, 2020

Introduce Option struct that represent format-option such as indent-size.
And some refactors :)

TODO

  • Change destination to master

/// - target: target
/// - debug: Enable debug-level output if `true` (like `debugPrint`)
/// - pretty: Enable pretty output if `true`
func string<T: Any>(_ target: T, debug: Bool, pretty: Bool) -> String {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename elementString to string.

Comment on lines +10 to +16
func _string(_ target: Any) -> String {
string(target, debug: debug, pretty: pretty) // fixed `debug` and `pretty`
}

func _value(_ target: Any) -> String {
valueString(target, debug: debug) // fixed `debug`
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add local function that fixed arguments debug and pretty.

Comment on lines +40 to +41
let label = _value(key)
let value = _string(val).indentTail(size: "\(label): ".count)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change call to local function _value and _string here and other.

@@ -0,0 +1,147 @@
class Pretty {
private var indent: Int { Debug.option.indent }
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is alias for Debug.option.indent.

@YusukeHosonuma YusukeHosonuma changed the base branch from refactor/some to master February 21, 2020 22:42
@YusukeHosonuma YusukeHosonuma merged commit 06afbcb into master Feb 23, 2020
@YusukeHosonuma YusukeHosonuma deleted the welcome/format-option branch February 23, 2020 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant