Class: GdocsBootstrap

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dictionaryObject

Returns the value of attribute dictionary.



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

def dictionary
  @dictionary
end

#headersObject

Returns the value of attribute headers.



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

def headers
  @headers
end

#key_nameObject

Returns the value of attribute key_name.



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

def key_name
  @key_name
end

#key_sprintfObject

set in options



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

def key_sprintf
  @key_sprintf
end

#target_class_nameObject

set in options



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

def target_class_name
  @target_class_name
end

#urlObject

set in options



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

def url
  @url
end

#widthObject

Returns the value of attribute width.



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

def width
  @width
end

Instance Method Details

#bootstrap!Object



10
11
12
13
14
15
16
17
# File 'lib/gdocs_bootstrap.rb', line 10

def bootstrap!
  load_dictionary unless dictionary_loaded?
  dictionary.each do |k, v|
    instance_of_target_class = target_class.send("find_or_create_by_#{key_name}", v[key_name])
    instance_of_target_class.update_attributes(v.except(key_name))
  end
  true
end