Class: Plt::Property

Inherits:
Object
  • Object
show all
Defined in:
lib/plt/property.rb

Class Method Summary collapse

Class Method Details

.parse(str) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/plt/property.rb', line 3

def self.parse(str)
  key, value = str.split("=")
  case key.to_sym
  in :unit      then { unit: value }
  in :scansc    then { scansc: true }
  in :emphasize then { emphasize: value.to_i }
  else               { key.to_sym => value.to_f }
  end
end

.to_plt(key, value) ⇒ Object



13
14
15
16
17
18
# File 'lib/plt/property.rb', line 13

def self.to_plt(key, value)
  case key
  when :scansc then "scansc"
  else              "#{key}=#{value}"
  end
end