Sha256: 180800105149369acebbcc19098c18313470fed4e90ec535aba70bf3f5427163
Contents?: true
Size: 845 Bytes
Versions: 1
Compression:
Stored size: 845 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 do |command_type| [command_type.name, command_type.key, :'data-syntax' => command_type.displayed_format] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rhea-0.2.0 | lib/rhea/command_type.rb |