diff --git a/website/docs/feature-flag-tutorials/ruby/implementing-feature-flags-ruby.md b/website/docs/feature-flag-tutorials/ruby/implementing-feature-flags-ruby.mdx similarity index 97% rename from website/docs/feature-flag-tutorials/ruby/implementing-feature-flags-ruby.md rename to website/docs/feature-flag-tutorials/ruby/implementing-feature-flags-ruby.mdx index f72b44f5b5..0798f45324 100644 --- a/website/docs/feature-flag-tutorials/ruby/implementing-feature-flags-ruby.md +++ b/website/docs/feature-flag-tutorials/ruby/implementing-feature-flags-ruby.mdx @@ -4,6 +4,8 @@ description: "How to use Unleash feature flags with Ruby." slug: /feature-flag-tutorials/ruby --- +import VideoContent from '@site/src/components/VideoContent.jsx'; + Hello! In this tutorial we’ll show you how to add feature flags to your Ruby app , using [Unleash](https://www.getunleash.io/) and the official [Unleash Ruby SDK](https://docs.getunleash.io/reference/sdks/ruby). With Unleash, an open-source feature flag service, you can use our tooling to add feature flags to your application and release new features faster. In a classic tutorial fashion, we’ll get a list of planets from the [Star Wars API](https://swapi.dev/), with just Ruby (i.e., not Ruby on Rails). We’ll use feature flags to decide whether to call the REST or the GraphQL version of the API. @@ -17,6 +19,11 @@ In a classic tutorial fashion, we’ll get a list of planets from the [Star Wars - [6. Verify the toggle experience](#6-verify-the-toggle-experience) - [Conclusion](#conclusion) +Watch the video tutorial and follow along with the code from this documentation. + + + + ## Prerequisites For this tutorial, you’ll need the following: diff --git a/website/docs/feature-flag-tutorials/rust/implementing-feature-flags-rust.md b/website/docs/feature-flag-tutorials/rust/implementing-feature-flags-rust.md index 5d1d7ed5f3..477c4d62ba 100644 --- a/website/docs/feature-flag-tutorials/rust/implementing-feature-flags-rust.md +++ b/website/docs/feature-flag-tutorials/rust/implementing-feature-flags-rust.md @@ -204,12 +204,13 @@ We want to let you choose the nature of that concurrency, so we're compatible wi ```rust use enum_map::Enum; use image::ImageReader; +use serde::{Deserialize, Serialize}; use std::error::Error; use std::fs; -use serde::{Deserialize, Serialize}; use std::time::Duration; use tokio::time::sleep; use unleash_api_client::client::ClientBuilder; +use unleash_api_client::Client; use webp::Encoder; #[derive(Debug, Deserialize, Serialize, Enum, Clone)] @@ -218,8 +219,8 @@ enum Flags { } #[tokio::main] -async fn main() -> Result<(), Box> { - let client = ClientBuilder::default().into_client::( +async fn main() -> Result<(), Box> { + let client:Client = ClientBuilder::default().into_client( "http://localhost:4242/api", "unleash-rust-client-example", "unleash-rust-client-example", @@ -232,17 +233,17 @@ async fn main() -> Result<(), Box> { sleep(Duration::from_millis(500)).await; let is_webp = client.is_enabled(Flags::webp, None, false); - process_images(is_webp)?; + process_image(is_webp)?; // allow tokio::join to finish client.stop_poll().await; - Ok::<(), Box>(()) + Ok::<(), Box>(()) }); Ok(()) } -fn process_image(is_webp: bool) -> Result<(), Box> { +fn process_image(is_webp: bool) -> Result<(), Box> { let img = ImageReader::open("input.png")?.decode()?; if is_webp {