Skip to content

Commit 5a34e76

Browse files
0.2.0 Documentation fixes (#5)
- Add boolean for enabled, removing contract extension. This is in favor of java users, since kotlin ones already have sealed-class usage + reactive one. Still, kotlin ones can use the property altough they are losing contract for type inference (not a big deal since the existence of sealed classes + reactive ones) - Add examples in all documentations - Add invoke companion operator to create lambda inlined providers - Remove both creational methods in favor of a single overloaded one
1 parent 3431659 commit 5a34e76

File tree

14 files changed

+43
-32
lines changed

14 files changed

+43
-32
lines changed

docs/0.x/feature-flags/com.saantiaguilera.featureflags.prioritized/-priority-feature-flag-provider/-init-.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ If all results are missing types, then the default feature value (missing) will
1111

1212
Example of a basic multi-prioritized group using static integers for priorities:
1313

14-
```
14+
``` kotlin
1515
// Simple wrapper class for creating providers with an int priority
1616
class StaticPriorityProvider(
1717
private val provider: FeatureFlagProvider,
@@ -32,16 +32,15 @@ class StaticPriorityComparator : Comparator<StaticPriority> {
3232
}
3333
}
3434

35-
// Usage:
35+
// Usage with 2 providers (of course it can be N):
3636
fun using() {
3737
val provider = PriorityFeatureFlagProvider(
3838
listOf(
3939
StaticPriorityProvider(yourProviderOne, priorityProviderOne),
4040
StaticPriorityProvider(yourProviderTwo, priorityProviderTwo)
41-
/* ... */
42-
),
43-
StaticPriorityComparator()
44-
}
41+
),
42+
StaticPriorityComparator()
4543
)
44+
}
4645
```
4746

docs/0.x/feature-flags/com.saantiaguilera.featureflags.prioritized/-priority-feature-flag-provider/index.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ If all results are missing types, then the default feature value (missing) will
1111

1212
Example of a basic multi-prioritized group using static integers for priorities:
1313

14-
```
14+
``` kotlin
1515
// Simple wrapper class for creating providers with an int priority
1616
class StaticPriorityProvider(
1717
private val provider: FeatureFlagProvider,
@@ -32,17 +32,16 @@ class StaticPriorityComparator : Comparator<StaticPriority> {
3232
}
3333
}
3434

35-
// Usage:
35+
// Usage with 2 providers (of course it can be N):
3636
fun using() {
3737
val provider = PriorityFeatureFlagProvider(
3838
listOf(
3939
StaticPriorityProvider(yourProviderOne, priorityProviderOne),
4040
StaticPriorityProvider(yourProviderTwo, priorityProviderTwo)
41-
/* ... */
42-
),
43-
StaticPriorityComparator()
44-
}
41+
),
42+
StaticPriorityComparator()
4543
)
44+
}
4645
```
4746

4847
### Constructors

docs/0.x/feature-flags/com.saantiaguilera.featureflags.prioritized/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Package com.saantiaguilera.featureflags.prioritized
44

5+
Priority public API package. Elements that allow prioritized behaviours reside here
6+
57
### Types
68

79
| Name | Summary |

docs/0.x/feature-flags/com.saantiaguilera.featureflags/-feature-flag-provider/index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ the state of a flag, it's ok.
1212

1313
Basic example
1414

15-
```
15+
``` kotlin
1616
val provider = FeatureFlagProvider { feature ->
1717
// check if the feature is enabled or not.
1818
}
@@ -21,7 +21,7 @@ val provider = FeatureFlagProvider { feature ->
2121
If a provider doesn't have the requested feature, it should respond with a missing one using
2222
[FeatureFlagResult.create](../-feature-flag-result/create.md) (specifying as a second parameter that it doesn't)
2323

24-
```
24+
``` kotlin
2525
val provider = FeatureFlagProvider { feature ->
2626
if (!/* check feature existence */) {
2727
// feature.value is the default provided value. We should also denote it doesn't exists.
@@ -30,6 +30,7 @@ val provider = FeatureFlagProvider { feature ->
3030

3131
// If the feature exists. return it from somewhere
3232
return FeatureFlagResult.create(/* get if the feature is enabled / disabled */)
33+
}
3334
```
3435

3536
On a more complex situation, you can create multi-providers such as
@@ -42,7 +43,7 @@ that constructs with a "User" (or know how to retrieve it) and react from it.
4243

4344
Example:
4445

45-
```
46+
``` kotlin
4647
class UserBasedProvider(
4748
private val userRepository: UserRepository,
4849
private val flagsRepository: MyFlagsRepository

docs/0.x/feature-flags/com.saantiaguilera.featureflags/-feature-flag-provider/invoke.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Constructs a provider for a lambda. This compact syntax is most useful for inline
88
providers.
99

10-
```
10+
``` kotlin
1111
val provider = FeatureFlagProvider { feature: FeatureFlag ->
1212
// Provide a result accordingly.
1313
}

docs/0.x/feature-flags/com.saantiaguilera.featureflags/-feature-flag/-init-.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This definition is based on the [flag](https://golang.org/pkg/flag) package defi
1010

1111
Example:
1212

13-
```
13+
``` kotlin
1414
object PaymentsFeatureCatalog {
1515
val enableVisaPayments = FeatureFlag(
1616
"feature.payments.cards.visa",

docs/0.x/feature-flags/com.saantiaguilera.featureflags/-feature-flag/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This definition is based on the [flag](https://golang.org/pkg/flag) package defi
1010

1111
Example:
1212

13-
```
13+
``` kotlin
1414
object PaymentsFeatureCatalog {
1515
val enableVisaPayments = FeatureFlag(
1616
"feature.payments.cards.visa",

docs/0.x/feature-flags/com.saantiaguilera.featureflags/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Package com.saantiaguilera.featureflags
44

5+
General public API package. All the core elements reside here
6+
57
### Types
68

79
| Name | Summary |

docs/0.x/feature-flags/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ A Feature Toggle (aka Feature Flags) Kotlin implementation
66

77
| Name | Summary |
88
|---|---|
9-
| [com.saantiaguilera.featureflags](com.saantiaguilera.featureflags/index.md) | |
10-
| [com.saantiaguilera.featureflags.prioritized](com.saantiaguilera.featureflags.prioritized/index.md) | |
9+
| [com.saantiaguilera.featureflags](com.saantiaguilera.featureflags/index.md) | General public API package. All the core elements reside here |
10+
| [com.saantiaguilera.featureflags.prioritized](com.saantiaguilera.featureflags.prioritized/index.md) | Priority public API package. Elements that allow prioritized behaviours reside here |
1111

1212
### Index
1313

feature-flags/Module.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
# Module feature-flags
22

3-
A Feature Toggle (aka Feature Flags) Kotlin implementation
3+
A Feature Toggle (aka Feature Flags) Kotlin implementation
4+
5+
# Package com.saantiaguilera.featureflags
6+
7+
General public API package. All the core elements reside here
8+
9+
# Package com.saantiaguilera.featureflags.prioritized
10+
11+
Priority public API package. Elements that allow prioritized behaviours reside here

0 commit comments

Comments
 (0)