Sha256: 30c9f207b0d318862bc983d6138c4dac73a8b2ec1b2bc1f5fc9b38875e3ed5d1
Contents?: true
Size: 779 Bytes
Versions: 1
Compression:
Stored size: 779 Bytes
Contents
module Rhea class CommandType attr_accessor :key, :name, :format def initialize(key:, name:, format:) self.key = key self.name = name self.format = format end def input_to_command_expression(input) format.gsub('$INPUT', input) end def displayed_format format.gsub('$INPUT', '$input') end def self.all @all ||= Rhea.configuration.command_types.map do |attributes| new(attributes) end end def self.find(key) command_type = all.find { |command_type| command_type.key == key } raise "Invalid key: #{key}" unless command_type command_type end def self.options_for_select all.map { |command_type| [command_type.name, command_type.key] } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rhea-0.1.0 | lib/rhea/command_type.rb |