Class: TypeScript::Rails::Transformer

Inherits:
Object
  • Object
show all
Defined in:
lib/typescript/rails/transformer.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(input) ⇒ Object



8
9
10
# File 'lib/typescript/rails/transformer.rb', line 8

def self.call(input)
  instance.call(input)
end

.instanceObject



4
5
6
# File 'lib/typescript/rails/transformer.rb', line 4

def self.instance
  @instance ||= new
end

Instance Method Details

#call(input) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/typescript/rails/transformer.rb', line 12

def call(input)
  filename = input[:filename]
  source   = input[:data]
  context  = input[:environment].context_class.new(input)

  result = ::TypeScript::Rails::Compiler.compile(filename, source, context)
  { data: result }
end