Class: PojoCreator

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

Constant Summary collapse

VERSION =
'0.2.0'

Instance Method Summary collapse

Constructor Details

#initialize(class_name) ⇒ PojoCreator

Returns a new instance of PojoCreator.



7
8
9
10
# File 'lib/pojo_creator.rb', line 7

def initialize(class_name)
  @class_name = get_class_name(class_name)
  @additional_classes = ""
end

Instance Method Details

#create_pojo(json_string) ⇒ Object



12
13
14
15
# File 'lib/pojo_creator.rb', line 12

def create_pojo(json_string)
  json = JSON.parse(json_string)
  pojo = "public class #{@class_name} {#{get_properties(json)}}" + @additional_classes
end