-
-
Save anonymous/a0f7c2c64ac8348c34d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'java' | |
java_import 'java.util.Properties' | |
java_import 'java.io.FileInputStream' | |
def get_properties_from_file | |
File.write('colors.properties', 'colors.pie=#FF0000, #00FF00, #0000FF') | |
props = Properties.new | |
fileInput = FileInputStream.new("/Users/keithb/work/temp/colors.properties") | |
props.load(fileInput) | |
fileInput.close | |
props | |
end | |
# def create_properties | |
# props = Properties.new | |
# props['colors.pie'] = '#FF0000, #00FF00, #0000FF' | |
# props | |
# end | |
# x = create_properties['foo'] | |
props = get_properties_from_file | |
colors_pie = props.getProperty('colors.pie') | |
p colors_pie.class | |
p colors_pie | |
colors_pie = props['colors.pie'] | |
p colors_pie.class | |
p colors_pie | |
# Output: | |
# String | |
# "#FF0000, #00FF00, #0000FF" | |
# String | |
# "#FF0000, #00FF00, #0000FF" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment