Class: Lamma::Runtime
- Inherits:
-
Object
- Object
- Lamma::Runtime
- Defined in:
- lib/lamma/runtime.rb
Constant Summary collapse
- C_SHARP =
10
- JAVA_8 =
20
- NODE_43 =
30
- EDGE_NODE_43 =
31
- PYTHON_27 =
40
- PYTHON_36 =
41
- NAME =
{ C_SHARP => 'dotnetcore1.0', JAVA_8 => 'java8', NODE_43 => 'nodejs4.3', EDGE_NODE_43 => 'nodejs4.3-edge', PYTHON_27 => 'python2.7', PYTHON_36 => 'python3.6', }
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(str) ⇒ Runtime
constructor
A new instance of Runtime.
- #to_dirname ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(str) ⇒ Runtime
Returns a new instance of Runtime.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/lamma/runtime.rb', line 16 def initialize(str) @type = case str when /^c[s#](harp)?$/i ::Lamma::Runtime::C_SHARP when /^java([-_\.\s]*8?)?$/i ::Lamma::Runtime::JAVA_8 when /^node([-_\.\s]*4(\.?3)?)?$/i ::Lamma::Runtime::NODE_43 when /^edge[-_\.\s]*node(\s*4(\.?3)?)?$/i ::Lamma::Runtime::EDGE_NODE_43 when /^python([-_\.\s]*2(\.?7)?)?$/i ::Lamma::Runtime::PYTHON_27 when /^python([-_\.\s]*3(\.?6)?)?$/i ::Lamma::Runtime::PYTHON_36 else raise ArgumentError.new("invalid runtime. #{str}") end end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/lamma/runtime.rb', line 3 def type @type end |
Class Method Details
.all ⇒ Object
5 6 7 |
# File 'lib/lamma/runtime.rb', line 5 def self.all self.constants.map{|n| [n, self.const_get(n)] }.to_h end |