<commit_before>#Attr Methods

# I worked on this challenge by myself.

# I spent 2 hours on this challenge.

# Pseudocode

# Input: a New instance of a greeting.
# Output: "Hello #{name}! How wonderful to see you today."
# Steps:
## Start with class NameData
## initialize with a name variable
## Create class Greetings
### intialize with an instance of NameData
### define another method to display the greeting with an input of name

class NameData
attr_reader :name
  def initialize
    @name = "<NAME>"
  end
end


class Greetings
  def initialize
    @NameData = NameData.new
  end
  def hello
    puts "Hello #{@NameData.name}! How wonderful to see you today."
  end
end

greet = Greetings.new
greet.hello


# Reflection

# Release 1

# What are the methods doing?
## Creating a person's profile (the class) that includes their name, age and occupation. 

# How are they modifying or returning the value of instance variables?
## They use instance methods change_my_* that allow you to call on instance variables to change their value.
## This is first accomplished by creating a new instance of the class with Profile.new


# Release 2

# What changed between the last release and this release?
## They added attr_reader :age.

# What was replaced?
## attr_reader :age replaced the method #what_is_age.

# Is this code simpler than the last?
## At this moment it is more DRY and simple yes.

# Release 3

# What changed between the last release and this release?
## attr_writer :age was added.

# What was replaced?
## The method #change_my_age was replaced with attr_writer.

# Is this code simpler than the last?
## Yes, having attr method allows us to replace instance methods with multiple lines of code. 
## This example can be even simpler is we replace, att_reader and att_writer with attr_accessor.


# Release 6<commit_msg>Add release 5 to solution file<commit_after>#Attr Methods

# I worked on this challenge by myself.

# I spent 2 hours on this challenge.

# Pseudocode

# Input: a New instance of a greeting.
# Output: "Hello #{name}! How wonderful to see you today."
# Steps:
## Start with class NameData
## initialize with a name variable
## Create class Greetings
### intialize with an instance of NameData
### define another method to display the greeting with an input of name

class NameData
attr_reader :name
  def initialize
    @name = "<NAME>"
  end
end


class Greetings
  def initialize
    @NameData = NameData.new
  end
  def hello
    puts "Hello #{@NameData.name}! How wonderful to see you today."
  end
end

greet = Greetings.new
greet.hello


# Reflection

# Release 1

# What are the methods doing?
## Creating a person's profile (the class) that includes their name, age and occupation. 

# How are they modifying or returning the value of instance variables?
## They use instance methods change_my_* that allow you to call on instance variables to change their value.
## This is first accomplished by creating a new instance of the class with Profile.new


# Release 2

# What changed between the last release and this release?
## They added attr_reader :age.

# What was replaced?
## attr_reader :age replaced the method #what_is_age.

# Is this code simpler than the last?
## At this moment it is more DRY and simple yes.

# Release 3

# What changed between the last release and this release?
## attr_writer :age was added.

# What was replaced?
## The method #change_my_age was replaced with attr_writer.

# Is this code simpler than the last?
## Yes, having attr method allows us to replace instance methods with multiple lines of code. 
## This example can be even simpler is we replace, att_reader and att_writer with attr_accessor.
 
# Release 5

class Profile
# first let's finish refactoring this code
# note that there is a way to add all of the variables like :age on one line, how would we do that?
  attr_accessor :age, :name, :occupation

  def initialize
    @age = 27
    @name = "Kim"
    @occupation = "Cartographer"
  end

  def print_info
    puts
    puts "age: #{@age}"
    puts
    puts "name: #{@name}"
    puts
    puts "occupation: #{@occupation}"
    puts
  end
end

# Release 6
{'fraction_non_alphanumeric': 0.06822565091610415, 'fraction_numerical': 0.0033751205400192863, 'mean_word_length': 3.7909930715935336, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5600226', 'n_tokens_mistral': 1196, 'n_tokens_neox': 1156, 'n_words': 594}