Using ruby keyword in application

Hey all,

In this line of code:

class Class
def dual_accessor(*attributes)
options = attributes.extract_options!
attributes.each do |attribute|
class_eval <<-ruby
class_inheritable_accessor :#{attribute}

    singleton_class.send :alias_method, :read_#{attribute},

:#{attribute}

    def self.#{attribute}(value = :__read__)
      if value == :__read__
        read_#{attribute}
      else
        self.#{attribute} = value
      end
    end
  ruby
  self.send(attribute, options[:default]) if options[:default]
end

end
end

I’m not sure what “<<-ruby ruby” is doing in there and how it impacts
the code.

Thanks for response.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs