Skip to content

Instantly share code, notes, and snippets.

@borntyping
Last active August 3, 2016 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save borntyping/2b06c7960132c918ecce5c09cd027b69 to your computer and use it in GitHub Desktop.
Save borntyping/2b06c7960132c918ecce5c09cd027b69 to your computer and use it in GitHub Desktop.
class TimePeriod
attr_accessor :seconds
def hours
seconds / 3600
end
def hours=(value)
seconds = value * 3600
hours
end
end
t = TimePeriod.new
t.hours = 24
puts "Time in hours: #{t.hours}"
class TimePeriod() {
var seconds = 0
// Getter
def hours = seconds / 3600
// Setter
def hours_= (value:Int):Unit = _seconds = value * 3600
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment