Skip to content

Instantly share code, notes, and snippets.

@rjpbonnal
Created January 13, 2011 10:25
Show Gist options
  • Save rjpbonnal/777672 to your computer and use it in GitHub Desktop.
Save rjpbonnal/777672 to your computer and use it in GitHub Desktop.
# Recode a vector based on a block
class Pippo
def recode!(vector_name)
0.upto(@cases-1) {|i|
@vectors[vector_name].data[i]=yield case_as_hash(i)
}
@vectors[vector_name].set_valid_data
end
end
class Pluto
def recode!(field)
qui devo richiamare istanza_di_pippo.recode!(field) con un blocco di codice.
end
end
@riffraff
Copy link

# Recode a vector based on a block

class Pippo
def recode!(vector_name)

  0.upto(@cases-1) {|i|
    @vectors[vector_name].data[i]=yield case_as_hash(i)
  }
  @vectors[vector_name].set_valid_data
end

end

class Pluto
def recode!(field,&b)
istanza_di_pippo.recode!(field,&b)
end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment