class HelloComputed::Contact

Attributes

first_name[RW]
last_name[RW]
year_of_birth[RW]

Public Class Methods

new(attribute_map) click to toggle source
# File lib/glimmer-dsl-opal/samples/hello/hello_computed.rb, line 26
def initialize(attribute_map)
  @first_name = attribute_map[:first_name]
  @last_name = attribute_map[:last_name]
  @year_of_birth = attribute_map[:year_of_birth]
end

Public Instance Methods

age() click to toggle source
# File lib/glimmer-dsl-opal/samples/hello/hello_computed.rb, line 36
def age
  Time.now.year - year_of_birth.to_i
rescue
  0
end
name() click to toggle source
# File lib/glimmer-dsl-opal/samples/hello/hello_computed.rb, line 32
def name
  "#{last_name}, #{first_name}"
end