Class: Makit::Cli::Generators::Templates::Dotnet::ProgramCs
- Inherits:
-
Object
- Object
- Makit::Cli::Generators::Templates::Dotnet::ProgramCs
- Defined in:
- lib/makit/cli/generators/templates/dotnet_templates.rb
Overview
Template generator for .NET Program.cs main entry point files
Generates a basic C# console application with a Main method that outputs “Hello, World!” to the console. The namespace is derived from the project name by capitalizing and joining segments.
Instance Method Summary collapse
-
#initialize(project_name) ⇒ ProgramCs
constructor
Initialize a new Program.cs template generator.
-
#render ⇒ String
Render the Program.cs C# source code content.
Constructor Details
#initialize(project_name) ⇒ ProgramCs
Initialize a new Program.cs template generator
64 65 66 |
# File 'lib/makit/cli/generators/templates/dotnet_templates.rb', line 64 def initialize(project_name) @project_name = project_name end |
Instance Method Details
#render ⇒ String
Render the Program.cs C# source code content
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/makit/cli/generators/templates/dotnet_templates.rb', line 71 def render " namespace \#{@project_name.split(/[-_]/).map(&:capitalize).join};\n\n class Program\n {\n static void Main(string[] args)\n {\n Console.WriteLine(\"Hello, World!\");\n }\n }\n CSHARP\nend\n" |