pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
    let is_rb_project = context
        .new_scan_dir()
        .set_files(&["Gemfile"])
        .set_extensions(&["rb"])
        .scan();

    if !is_rb_project {
        return None;
    }

    match get_ruby_version() {
        Some(ruby_version) => {
            const RUBY_CHAR: &str = "💎 ";

            let mut module = context.new_module("ruby");
            let module_style = module
                .config_value_style("style")
                .unwrap_or_else(|| Color::Red.bold());
            module.set_style(module_style);

            let formatted_version = format_ruby_version(&ruby_version)?;
            module.new_segment("symbol", RUBY_CHAR);
            module.new_segment("version", &formatted_version);

            Some(module)
        }
        None => None,
    }
}
/// Creates a module with the current Ruby version
///
/// Will display the Ruby version if any of the following criteria are met:
///     - Current directory contains a `.rb` file
///     - Current directory contains a `Gemfile` file
Creates a module with the current Ruby version
Will display the Ruby version if any of the following criteria are met:
Current directory contains a `.rb` file
Current directory contains a `Gemfile` file
Creates a module with the current Ruby version Will display the Ruby version if any of the following criteria are met : Current directory contains a ` . rb ` file Current directory contains a ` Gemfile ` file
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
    let is_rb_project = context
        .new_scan_dir()
        .set_files(&["Gemfile"])
        .set_extensions(&["rb"])
        .scan();
    if !is_rb_project {
        return None;
    }
    match get_ruby_version() {
        Some(ruby_version) => {
            const RUBY_CHAR: &str = "💎 ";
            let mut module = context.new_module("ruby");
            let module_style = module
                .config_value_style("style")
                .unwrap_or_else(|| Color::Red.bold());
            module.set_style(module_style);
            let formatted_version = format_ruby_version(&ruby_version)?;
            module.new_segment("symbol", RUBY_CHAR);
            module.new_segment("version", &formatted_version);
            Some(module)
        }
        None => None,
    }
}
pub fn module < ' a > ( context : & ' a Context ) -> Option < Module < ' a > > { let is_rb_project = context . new_scan_dir ( ) . set_files ( & [ " " ] ) . set_extensions ( & [ " " ] ) . scan ( ) ; if ! is_rb_project { return None ; } match get_ruby_version ( ) { Some ( ruby_version ) => { const RUBY_CHAR : & str = " let mut module = context . new_module ( " " ) ; let module_style = module . config_value_style ( " " ) . unwrap_or_else ( | | Color :: Red . bold ( ) ) ; module . set_style ( module_style ) ; let formatted_version = format_ruby_version ( & ruby_version ) ? ; module . new_segment ( " " , RUBY_CHAR ) ; module . new_segment ( " " , & formatted_version ) ; Some ( module ) } None => None , } }
Creates a module with the current Ruby version
Will display the Ruby version if any of the following criteria are met:
 Current directory contains a `.rb` file
 Current directory contains a `Gemfile` file
Creates a module with the current Ruby version Will display the Ruby version if any of the following criteria are met : Current directory contains a ` . rb ` file Current directory contains a ` Gemfile ` file
context
&'a Context