Module: Mulang::RunMode

Defined in:
lib/mulang.rb

Defined Under Namespace

Modules: ForcedMany, Natural

Class Method Summary collapse

Class Method Details

.encode_serialization(option) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/mulang.rb', line 37

def self.encode_serialization(option)
  case option
  when nil then '-S'
  when :bracket then '-B'
  when :brace then '-C'
  else raise "Unsupported serialization #{option}"
  end
end

.for(analysis, options) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/mulang.rb', line 25

def self.for(analysis, options)
  serialization = options[:serialization]
  many = analysis.is_a?(Array)
  if many
    [encode_serialization(serialization), Mulang::RunMode::Natural]
  elsif serialization
    [encode_serialization(serialization), Mulang::RunMode::ForcedMany]
  else
    ["-s", Mulang::RunMode::Natural]
  end
end