spells.CustomRenderingModule.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spells_2.11 Show documentation
Show all versions of spells_2.11 Show documentation
This is a small scala "util" library, which will hopefully grow over time.
The newest version!
package spells
/** This module provides the `CustomRendering` trait, which is used throughout the whole library, especially in the `XrayModule`.
*/
trait CustomRenderingModule {
this: StringOpsModule with SpellsConfigModule =>
trait CustomRendering {
/** Renders anything. Used as view bound in many places, like `xray`.
* @param availableWidthInCharacters might be used by implementations
* @return a `String` rendering.
*/
def rendered(implicit availableWidthInCharacters: StringOpsModule#AvailableWidthInCharacters = SpellsConfig.terminal.WidthInCharacters.value): String
}
object CustomRendering {
object Defaults {
object Any extends (Any => CustomRenderingModule#CustomRendering) {
final def apply(any: Any): CustomRenderingModule#CustomRendering = new CustomRendering {
override final def rendered(implicit availableWidthInCharacters: StringOpsModule#AvailableWidthInCharacters = SpellsConfig.terminal.WidthInCharacters.value): String =
String valueOf any
}
}
}
}
}